# New in Arduino - Using Bounce2 and an ISR to change leds light mode effects

**URL:** <https://forum.arduino.cc/t/new-in-arduino-using-bounce2-and-an-isr-to-change-leds-light-mode-effects/1159964>\
**Category:** Programming\
**Created:** [August 20, 2023, 1:18am UTC](https://forum.arduino.cc/t/new-in-arduino-using-bounce2-and-an-isr-to-change-leds-light-mode-effects/1159964 "2023-08-20T01:18:18Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![sterretje](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sterretje/32/391294_2.png) [@sterretje](https://forum.arduino.cc/u/sterretje)\
**Post date:** [August 20, 2023, 7:16am UTC](https://forum.arduino.cc/t/new-in-arduino-using-bounce2-and-an-isr-to-change-leds-light-mode-effects/1159964/3 "2023-08-20T07:16:17Z")

</div>

You don't need interrupts to react on a button. You will need to learn to write non-blocking code (so not using delay).

There are plenty articles on the web to achieve the above; e.g.

> [@Using millis() for timing. A beginners guide](https://forum.arduino.cc/t/using-millis-for-timing-a-beginners-guide/483573):
>
> Part 1 It is not usually long before new Arduino users discover that although the delay() function is easy to use it has side effects, the main one of which is that its stops all activity on the Arduino until the delay is finished (not quite true, I know, but that is usually how the problem presents itself). When this occurs the new user is usually directed to the BlinkWithoutDelay example sketch (BWoD) and/or the excellent thread entitled Several things at the same time. [Several things at the…](http://forum.arduino.cc/index.php?topic=223286.0)

And some more reading

> [@Explaining how to write NON-blocking all time responsive code](https://forum.arduino.cc/t/explaining-how-to-write-non-blocking-all-time-responsive-code/1126414):
>
> Hi Everybody, from time to time I enjoy writing tutorials in my kind and style. My intention is to make it easy to understand. Though I'm aware: of the fact that one way of explaining things is not the best way for everybody. that the best experts about easyness-to-understand are: beginners . I want to encourage especially beginners to ask whatever question comes to their mind. I will use these questions as suggestion to improve the tutorial to become even more easy to understand. The u…

> [@Demonstration code for several things at the same time](https://forum.arduino.cc/t/demonstration-code-for-several-things-at-the-same-time/217158):
>
> NOTE for newcomers. The demo is entirely contained in this Post and Reply #1. There is no need to read further unless you are interested. ...added 25Sep2014 There have been a few occasions recently where newcomers seemed to have difficulty applying the "blink without delay" and "state" concepts to a sketch that is intended to manage a number of concurrent actions. Its very time consuming to respond with suitable code examples - particularly as every case is a little different. I have prepared…

> **[Multi-tasking the Arduino - Part 1](https://learn.adafruit.com/multi-tasking-the-arduino-part-1/overview)**
>
> Once you have mastered the basic blinking leds, simple sensors and buzzing motors, it’s time to move on to bigger and better projects. That usually involves combining bits and pieces of simpler sketches and trying to make them work together. The...

You will also need to learn not to use magic numbers (your pin numbers); you do it correctly for the button pin but not for the LED pins.

---

_[View the full topic](https://forum.arduino.cc/t/new-in-arduino-using-bounce2-and-an-isr-to-change-leds-light-mode-effects/1159964)._
