Questions tagged [button]

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

Filter by
Sorted by
Tagged with
1 vote
2 answers
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 ...
Jellybramble's user avatar
14 votes
1 answer
8k 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() { ...
sachleen's user avatar
  • 7,395
2 votes
1 answer
979 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 ...
sylcat's user avatar
  • 65
11 votes
4 answers
6k 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 ...
Sergey Snegirev's user avatar
5 votes
3 answers
8k 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 ...
Kokodoko's user avatar
  • 151
8 votes
2 answers
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 ...
Cerin's user avatar
  • 1,598
6 votes
5 answers
8k 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.
Christopher Muhlbauer's user avatar
5 votes
3 answers
3k 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 ...
Peter Bloomfield's user avatar
4 votes
5 answers
14k 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() { // ...
Utsav's user avatar
  • 231
4 votes
3 answers
35k 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(...
Patrick Bucher's user avatar
4 votes
1 answer
502 views

Controlling relays with IR and button

What I have: 1 x 8 channel relay 1 x IR receiver 1x Arduino Uno 1x momentary switch 1x breadboard 1x 10K resister I think the wiring is all ok as for the most part things are working as they should.....
Michael Sinclair's user avatar
3 votes
3 answers
4k 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 ...
makepeace's user avatar
2 votes
2 answers
5k 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 ...
kaay's user avatar
  • 223
2 votes
4 answers
962 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 ...
Dallin's user avatar
  • 23
1 vote
1 answer
2k 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 ?
VishwaV's user avatar
  • 111
1 vote
2 answers
539 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 ...
HiWay's user avatar
  • 109
1 vote
3 answers
202 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 ...
HiWay's user avatar
  • 109
0 votes
1 answer
841 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(...
Itzik.B's user avatar
  • 131
0 votes
4 answers
2k 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 ...
user19964's user avatar
0 votes
1 answer
905 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&...
medo's user avatar
  • 11
0 votes
1 answer
740 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....
Veselin's user avatar
0 votes
2 answers
356 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 ...
Marvin's user avatar
  • 3
0 votes
1 answer
844 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 ...
Daniel Frausto's user avatar
0 votes
2 answers
986 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 ...
Jet Propelled Insectivore's user avatar