PyRasp

← All practice problems

Raspberry Pi Pico practice problem · Raspberry Pi Pico

Reaction timer

MediumBudget $4MicroPython

A red LED is on GP13 and a push button on GP12 (wired to 3V3, so the pin needs a down pull). The LED comes on immediately; wait for the first press, then print

reaction <milliseconds since the program started>

Use utime.ticks_ms(); the press in the test comes at about one second.

More in Raspberry Pi Pico