How do I do nothing?
Posted: Fri Oct 22, 2021 12:44 pm
Hello, I have the code below I don't want my buttons number to go below 0 and give me -1, -2 etc. and I want to do an else "Do Nothing". What in would I use for MicroPython for that? I tried Pass and Continue but get an invalid syntax. I also want to know is there a "Cheat Sheet" for symbols and their meaning like Python has that I can reference? Thanks!
Code: Select all
def count_down(pin):
global rnds_clicks
if btn_rnds_down.value() == 1:
# Print 14 blank spaces to clear round counter
lcd.move_to(6,3)
lcd.putstr(" ")
rnds_clicks -= 1 #Decreases 1 to the rounds counter
lcd.move_to(6,3)
lcd.putstr('{}'.format(rnds_clicks))
utime.sleep(0.25)
else
'Do nothing'
#Attach interrupt to btn_rnds_down
btn_rnds_down.irq(trigger=machine.Pin.IRQ_RISING, handler=count_down)