Button2
Button2 copied to clipboard
Multiple Button Issue
I am running into problems using Button2 with multiple buttons. I thought it might be something I was coding wrong, but I have this exact same problem with the "Multiple Buttons" example that comes with the library.
I have two buttons connected to an Arduino Uno Rev 3 on pins 7 & 8. (The other lead to the button is connected to the ground pins.) I'm connected to my Linux desktop through /dev/ttyACM1 (USB).
Everything works fine for about 15-20 seconds, as I randomly press the buttons. Then things begin to slow. I can press Button A multiple times, and only see one line print in the Serial Monitor. Or alternate and see an occasional A or B show up. Maybe 1 line out of 8 or 10 button pushes.
I don't think its the serial connection or monitor, because my original code uses LEDs to indicate a button has been pushed, and they show the same random push behavior.
And If I just test one of the buttons at a time, using the "Single Button" example (on pins 7 or 8) everything is fine and works as expected. I don't change the wiring, only the example code I'm using.
I'm working on a build where I'll have many buttons, not just two, so I want to make this work.
How can I better debug this to figure out what is going wrong?
FWIW, here is the diagnostic details from avrdude:
Using Port : /dev/ttyACM1
Using Programmer : arduino
Overriding Baud Rate : 115200
AVR Part : ATmega328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : Arduino
Description : Arduino
Hardware Version: 3
Firmware Version: 4.4
Vtarget : 0.3 V
Varef : 0.3 V
Oscillator : 28.800 kHz
SCK period : 3.3 us