Skip to main content
15 votes

What is the best technique to design a 20 push button circuit

For 20 buttons you can use a Keypad Matrix arrangement (plenty of examples online) where you would use only 9 pins (5 columns of 4 rows is 5+4 pins). It's slightly more involved that simple 1:1 ...
Majenko's user avatar
  • 106k
9 votes

How do I repurpose Arduino's reset button

If you just want the reset button to change the program mode, the simplest thing would be to let the button reset the Arduino and switch modes each time your program restarts. Then you do not need to ...
Edgar Bonet's user avatar
  • 44.3k
8 votes
Accepted

Debouncing a button with interrupt

So, I grabbed a Mega and several pushbutton switches (one of which turned out to be a push-on, push-off, much to my bemusement), and ginned up a small Arduino program to illustrate an interrupt-driven ...
starship15's user avatar
7 votes
Accepted

button connection without connection to 5V pin

There is a pullup resistor you don't see in the diagram because it is internal to the Arduino. I have added it in red. To make pin 7 an input, you can write: digitalWrite(7, INPUT_PULLUP); , which ...
JRobert's user avatar
  • 15.3k
6 votes

Press the Windows key using "keyboard.press();"

They Keyboard.press() command accept modifiers per the documentation. You may need to do multiple press() commands before releasing. For example, if you want to launch File Explorer you could use: ...
Eric G's user avatar
  • 161
6 votes

Voltage changes but digitalRead always HIGH

The problem is that when the button isn't pressed, the voltage at pin D3 is just floating. Since there is nothing attached, the voltage at the pin can be anything. To prevent this, you use a pull-down ...
Gerben's user avatar
  • 11.3k
6 votes
Accepted

Powering potientiometer/button with a digital pin

You can likely use an I/O pin as an output to "power" fairly high-impedance devices such as pullup resistors for buttons, or even potentiometers of moderate to high total resistance. A ...
Chris Stratton's user avatar
6 votes

Buttons, LOW vs no connection

There must be a difference between a LOW reading and no connection, correct? No, the input circuitry measures a voltage. The exact details are in the datasheet, but how could it know there is ...
Nick Gammon's user avatar
  • 38.7k
6 votes
Accepted

Do I need a pull-up/down resistor for button LED circuit?

The circuit you have made is only using Arduino as a 5V power source. You aren't using any GPIO pins to read the state of the button or to control the LED by an output pin. You've just made a plain-...
jose can u c's user avatar
  • 6,974
6 votes

How do I make another action repeat inside a loop?

By using delay() it blocks the rest of the code. The programme needs to keep track of two buttons and update the lightshow at appropriate times, therefore a non-blocking style of coding is needed ...
tim's user avatar
  • 699
5 votes

How should I connect 5 buttons to arduino so that I can use the least number of inputs all the buttons are connected to ground

If all switches have one input grounded, you cannot use matrixing. In any case, the best you could do would be a 2 * 3 matrix, which uses 5 signals, the same as individual switching (though you may ...
user_1818839's user avatar
5 votes
Accepted

Push button restarts the arduino

If your button creates a short circuit between 5V and GND pins... it will certainly act like a RESET. Let's try to make sure you are not creating a dead short on an Arduino pin so you avoid ...
Peter Willard's user avatar
5 votes
Accepted

Arduino alternating between high and low signal without button press

Look at this breadboard image: I have marked the power rail connections with green and red lines. Do you see, that they are not connected in the middle, right there where I've drawn the blue dotted ...
chrisl's user avatar
  • 16.5k
5 votes

Push button issues

You've got the button wired wrong. Your resistor is inline with the signal going to the pin. It should be going from the pin to 5V. The button should be wired directly to the pin and ground. Or ...
Delta_G's user avatar
  • 3,390
4 votes

Choosing wireless tech for lowest possible lag

Have you considered using real time clocks? You could synchornise them all ahead of time and then use any wireless protocol. Once a button is pressed, you'll look for the unit that reports the ...
Squats's user avatar
  • 129
4 votes
Accepted

Detecting if a push button was pressed and released

No, I wouldn't consider that good practice - for one good reason: it's blocking. Your system can't be doing anything else at all while you're waiting on the button. That may be fine for some ...
Majenko's user avatar
  • 106k
4 votes

Detecting if a push button was pressed and released

I concur with Majenko, although your code would work, the code is blocking, meaning that your code stops at that point until the button is released again. The remaining code in your loop does not ...
sa_leinad's user avatar
  • 3,198
4 votes

Detecting if a push button was pressed and released

"I usually put a capacitor next to my push button" A 1uF capacitor across the button is easy, cheap and means no need to fiddle with debouncing codes. See Nick Gammon's excellent switch tutorial that ...
Systembolaget's user avatar
4 votes
Accepted

Interrupts: use of the "volatile" keyword with a structure pointer for button debounce

I think, that the problem is in ideb_read, which expects "a pointer to (non-volatile) structure" and so it does not care about re-reading ideb->output if it can it optimize out somehow (say putting ...
gilhad's user avatar
  • 1,420
4 votes

Interrupts: use of the "volatile" keyword with a structure pointer for button debounce

Getting pointer declarations right can be anything but obvious, especially where const and volatile are concerned (which are syntactically equivalent). Your problem stemmed from the confusion between "...
JRobert's user avatar
  • 15.3k
4 votes
Accepted

Code test the duration press of the button

Why did the timers stop working? The main issue seems to be that freeze_timer and btn_timer are of type unsigned int, while millis, as stated in its documentation, returns an unsigned long. As you ...
tlongeri's user avatar
4 votes

Arduino Timer with increase time button

I don't fully understand your program, but I hope to give some guidelines/tips: Instead of using all kind of different variables, with hour, minutes and seconds, with with only one variable that ...
Michel Keijzers's user avatar
4 votes

How to make an arduino button to forget his past purpose?

What you likely need is a state machine. The behavior of the actions depends on the state the program is currently in. In your case, the state machine might look like this: What does it mean? black ...
Thomas Weller's user avatar
4 votes

button connection without connection to 5V pin

The digital pins of an Arduino UNO, or rather the AVR microcontroller used in the UNO, have optional internal pull-up resistors that can be enabled with the INPUT_PULLUP option to pinMode. When you ...
timemage's user avatar
  • 5,414
4 votes

What is the best technique to design a 20 push button circuit

The example project below can control 16 switches. If you have a membrane keypad with 5 x 4 or 5 x 5 then you can meet your requirement. I will shortly add an example of using shift registers to have ...
ArduinoFan's user avatar
  • 1,079
4 votes

Tone() generates a high pitched sound when button is released

Here is the result of my investigation. The problem is caused by two factors. First one is the contact bounce of the switch. Second one is inadequate pullup strength at the switch, but this may be a ...
jsotola's user avatar
  • 1,525
4 votes
Accepted

Sketch halts if button is pressed on boot

Description of pin D3 from this ESP8266 pinout reference: connected to FLASH button, boot fails if pulled LOW So you cannot pull this pin to LOW during boot, as it will keep the ESP in flash mode. ...
chrisl's user avatar
  • 16.5k
3 votes

Good button debouncing/stateChange library

I'm on this subject right now and I'll use this to note my findings. I found many libs on this, and this is my wishlist: support many buttons support toggles or switches support debouncing and maybe ...
Feu's user avatar
  • 131
3 votes

Stop Led's from blinking

EDITED The Arduino loop() function makes the use of a while loop redundant in this case. Even worse: the way you've implemented that while loop prevents buttonState from being updated, thus getting ...
Enric Blanco's user avatar
  • 2,114

Only top scored, non community-wiki answers of a minimum length are eligible