pin.wait-for x
task
import gpio
main:
pin := gpio.Pin 32 --input --pull-up
task::
while true:
pin.wait-for 0
print "Got pulled to ground"
sleep --ms=200 // Debounce.
pin.wait-for 1
sleep --ms=200 // Debounce.
while true:
print "In main-loop"
// Let other tasks run.
// The 'sleep' function automatically yields. Otherwise a call to 'yield' would
// also give other tasks a chance to run.
sleep --ms=1_000