I have 2 arduino nano and have setup them as a transmitter and reciever. I press a button on the transmitter and the reciever lights up the individual addressable LED sequence as programmed.

The issue is that when I release the button, the signal is sent 3 to 4 times even when the switch is open, this causes the LED sequence to run thrice before returning to the original state. I also tried to ads a delay to remove the bouncing but still no luck.

  • the problem is in your code – jsotola Nov 5 '18 at 3:51

You are witnessing button bouncing. You need to incorporate a "button debounce" in your code. What is happening is when you press the button your code continues to loop (e.g. cycle). The Arduino detects the button is pressed every cycle. If your arduino has a 16 mhz crystal oscillator its means 16 Million cycles per second. Thats fast, much faster than you press and release the button.

There are number of why to solve this. One is using an interrupt instead of polling, but you will still need to incorporate a debounce.

Google Arduino Button Debounce.

|improve this answer|||||

Not the answer you're looking for? Browse other questions tagged or ask your own question.