run your code inside a try / except structure. As Ctrl-C raises an exception, as soon as it happens your code in the 'except:' part gets run:Any error at runtime that raises an exception will cause the code under 'except:' to be run
Code:
try: while True: led.value(not led.value()) sleep_ms(1200)except: led.value(0) # turn it off if user quits exit()
Statistics: Posted by scruss — Thu Feb 29, 2024 4:19 pm