PyRasp

← All practice problems

Raspberry Pi Pico practice problem · Raspberry Pi Pico

Blink with a timer

MediumBudget $4MicroPython

The same blink, without calling sleep between toggles: a Timer flips GP13 every 500 ms (one full cycle per second), and main.py just keeps sleeping.

timer = Timer()
timer.init(period=500, mode=Timer.PERIODIC, callback=flip)

In this simulator timer callbacks run right after each sleep, so the main loop should utime.sleep_ms(10).

More in Raspberry Pi Pico