With regards to the your reply, i switched to using <= due to python being a zero index language.
Since writing my first reply, I also thought maybe the flashersBtnPress + 1 statement was what's failing. So I wrote a new version that solely adds one to the variable. When I run this code, the same issue occurs., which makes me think this line of code is failing.
Since writing my first reply, I also thought maybe the flashersBtnPress + 1 statement was what's failing. So I wrote a new version that solely adds one to the variable. When I run this code, the same issue occurs., which makes me think this line of code is failing.
Code:
from gpiozero import LED, Buttonfrom time import sleepflashersBtnPress = 0yLed = LED(4)yLed2 = LED(17)rLed = LED(14)rLed2 = LED(15)b12 = Button(12)def flashers(): global flashersBtnPress flashersBtnPress + 1 print(flashersBtnPress)b12.when_pressed = flasherswhile True: pass Statistics: Posted by thisissigma — Thu Nov 27, 2025 6:57 pm