Questions tagged [button]

A button is a simple input component which responds to being pushed by a user.

Filter by
Sorted by
Tagged with
14
votes
1answer
7k views

Button state changing randomly

I have a push button wired to my Arduino but it seems to be triggering randomly. I have one pin of the button connected to pin 2 on the arduino and the other connected to ground. void setup() { ...
5
votes
3answers
6k views

Why does this button have a connection to ground?

I am testing this basic button example from the Arduino tutorial page. This circuit lets power flow to pin 2 when the button is pressed. When the button is not pressed, the power goes through the ...
1
vote
2answers
3k views

How to simulate delay() to debounce mechanical button using millis()?

Im trying to use the millis() function as a replacement for the delay() function in order to debounce a mechanical button. This is for an electric drum kit I am building. Im using a teensy Arduino to ...
2
votes
1answer
873 views

Arduino sending keystrokes via push-buttons. Proper bouncing and manually setting buttons?

I have a simple set of 8 push buttons wired to a Teensy 3.2 board (which uses Arduino via Teensyduino plugin). The 8 buttons are on pins 1-8 and their common ground line (one line soldered to each of ...
11
votes
4answers
5k views

Choosing wireless tech for lowest possible lag

I am drafting a pub quiz project, where the Referee gives a signal and multiple players push their buttons. The first to push wins the right to give an answer. I want all buttons (referee's + X ...
8
votes
2answers
626 views

How frequently do you need to poll UI buttons before they are perceived as laggy?

Whilst it is possible, and sometimes desirable, to use pin change interrupts to read the state of buttons, it is simpler to poll the state of buttons in loop(). This is a commonly used technique. If ...
0
votes
1answer
39 views

I am trying to combine a button's coding and servo's coding. But it is still cannot be verified. What have I done wrong? [duplicate]

include Servo myservo; void setup(){ myservo.attach(8); pinMode(buttonPin, INPUT); } void loop() { myservo.write(0); delay(3); myservo.write(90); delay(3); } const int inPin=8; ...
-1
votes
1answer
64 views

Code and wire a LCD and button [closed]

I need to code and wire: “Button is pressed.” to an LCD screen when a button is pressed. When the button is released, the LCD should display, “Button is released.” NEED HELP!!!
8
votes
2answers
2k views

Performance of internal vs external resistors

Is there any significant performance trade-off between buttons wired with the internal vs external pull-up/down resistors? I see a lot of tutorials demonstrating the use of external resistors when ...
4
votes
5answers
7k views

How do I repurpose Arduino's reset button

Is there a way to repurpose the reset button for the code, like an on-board button? I don't need it to reset, but it would be useful to make it run through a list of RGB LED cycles.
2
votes
2answers
4k views

Multiple buttons on single interrupt, how to debounce?

Buttons on separate interrupt pins work fine (triggered on FALLING), bouncing is handling by forcing a 80ms lockout period during which further presses are ignored. I like that solution for being ...
2
votes
1answer
9k views

Button with switch timer and reset time function + LED feedback. What am I doing wrong?

Beginner here. I´ve been trying to implement a button function timer working with millis() instead of delay as I want the button to be responsive while the timer is running. So far I´ve managed to ...
6
votes
3answers
2k views

Why does my sketch report too many button presses?

I've been using a button to interact with a sketch (on my Uno), and it's mostly working fine. However, sometimes it seems to be detecting multiple presses when it's only pressed once. It's a small ...
3
votes
3answers
27k views

Detecting if a push button was pressed and released

I want to detect if a push button was pressed and released again. So I thought the right approach would be to first wait while the pin yields LOW and then wait while the pin yields HIGH: void push(...
4
votes
5answers
11k views

Stop Led's from blinking

My code: // Pin 13 has a LED connected on most Arduino boards. // give it a name: int led = 13; const int buttonPin = 2; // the setup routine runs once when you press reset: void setup() { // ...
3
votes
3answers
3k views

Breaking a switch case from an ISR

I'm struggling with something. My CPU sits in a switch case state machine like this: switch(expression) { case constant-expression_1 : statement(s); break; /* optional */ case ...
2
votes
4answers
844 views

Why doesn't this debounce function work?

Edit 2 I made a function that works, but I'm still confused about just one thing... I'm very confused about how variables work in C++. In this program... boolean debounce(void) { static ...
1
vote
3answers
183 views

Problem with Dual Safety Switches Initiating Timed Relay

I have been working on an Arduino project that has me kind of stumped. What it needs to achieve is that two momentary safety switches need to be pushed and held within a specified time frame as ...
1
vote
2answers
519 views

State Machine Logic problem with added states monitoring safety switches

I have been working on getting a state machine to work correctly but am having trouble with adding in the last bit of logic. What it needs to do is several things: Read two button inputs. Make sure ...
0
votes
1answer
632 views

Multiple buttons to control relays

Dears, I have a problem that I could not solve for a while, I tried the code below but it did not work. There will be 4 buttons controlling 4 relays but in a way that button one will turn relays 1&...
0
votes
1answer
316 views

read state from button to check if clicked

I"m kinda new here and new to the arduino framework. I want to build a "menu" using LCD 20*4, so I want to detect "button clicked" event. I've connected button to pin 8 and to ground, like this(...
0
votes
2answers
174 views

Restart sequence of NeoPixel stick with a push button at any time

I am really happy with my new Arduino stuff and playing around with all those pixels :). I am new to programming and it's difficult to understand it, but with every success, I grow in knowledge. My ...
0
votes
2answers
879 views

Multiple buttons activating different methods for an LED strip

I am trying to use different buttons to activate different methods for an LED strip. However, when one button is pressed after another has been pressed, I want it to interrupt the first buttons method ...
0
votes
1answer
247 views

How to connect Big Dome Button with arduino

I am quite new to arduino and for a project I want to use big dome button which when pressed it will count how many times has been pressed.It is using 12 volts.The button is this https://www.sparkfun....
0
votes
4answers
1k views

Detecting how many button presses(single tap, double tap etc) with two simultaneous buttons

noob here So what I am trying to do is output a different number depending on the number of button presses e.g. for 1 button press it should output 1 and so forth. After that I only really want the ...
0
votes
1answer
702 views

How to change Void with button press

I have 2 buttons and 2 voids (blink_slow) (blink_fast). i need to be able to press button 1 and blink-slow void will run, then press button 2 and blink fast will run. none of my code works, any idea ...
0
votes
1answer
1k views

Arduino - Calculating the time for which a Pushbutton is pressed and held without being released

I'm working on a project that requires calculating the time for which a pushbutton is kept pressed without being released. Is there a code snippet that i can use for this particular need ?