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.

closed as unclear what you're asking by per1234, VE7JRO, Greenonline, sempaiscuba, jsotola Nov 5 '18 at 3:51

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 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.

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