There a many different ways to accomplish this. The method shown below sets a "flag" whenever the pot value goes high. The flag is then reset when the pot goes low.
The flash lights() function is only called when the potValue goes above the threshold and the flag is set. Once the lights() function is called the flag is changed and needs to be reset before the function can be called again.
Here is a video of the circuit and the sketch is below...
VIDEO
SKETCH
Loading ....
No comments:
Post a Comment