floitsch
07/17/2025, 2:02 PMpin.wait-for 1
Under the hood, Toit uses interrupts to wake up your task, when the pin changes.
If you want to do other things while waiting you just do this wait-for in a separate task.
task::
while true:
pin.wait-for 1
print "1"
pin.wait-for 0
...
Note that you would usually have a small sleep before/after each wait-for to debounce