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 ...
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 ...
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 ...
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 ...
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:
...
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 ...
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 ...
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 ...
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-...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 "...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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. ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
button × 345arduino-uno × 130
led × 58
programming × 25
lcd × 23
debounce × 23
servo × 19
arduino-mega × 17
arduino-nano × 17
interrupt × 17
switch × 17
c++ × 14
sensors × 12
serial × 11
potentiometer × 11
esp8266 × 10
motor × 10
loop × 10
arduino-ide × 9
timers × 9
code-review × 9
stepper × 9
input × 9
resistor × 9
millis × 8