Blink Timing Explorer
Run the Blink Timing Explorer MicroSim Fullscreen
You can include this MicroSim on your website using the following iframe:
1 2 | |
About This MicroSim
This MicroSim simulates the three-line blink loop that every Raspberry Pi Pico 2 project starts with:
1 2 3 | |
The top strip chart plots the LED pin as a voltage-versus-time square wave with only two levels — logic high at 3.3 V and logic low at 0 V. The onboard-LED icon lights gold whenever the simulated pin is high. As you drag the Sleep delay slider, the wave visibly alternates faster or slower and the Blinks per second readout changes with it.
The key relationship on display is that one complete blink takes two toggles, so:
1 | |
A delay of 0.5 s therefore produces 1.0 blink per second, not 2.
How to Use
- Before touching anything, predict: at the default 0.5 s delay, how many times per second will the LED complete a full on-and-off cycle?
- Press Run and count the transitions on the strip chart to check your prediction against the readout.
- Drag Sleep delay to 0.05 s and then to 2.0 s. Notice that the square wave packs together or stretches out, but the two voltage levels never change.
- Press Pause, then use Toggle Once to step through a single logic-low to logic-high transition in isolation.
- Check Show code to see the exact loop being simulated with your current
slider value substituted into
sleep().
Controls
| Control | Purpose |
|---|---|
| Run / Pause | Starts and stops the automatic toggle-and-delay loop |
| Toggle Once | Pauses, then performs exactly one state flip so a single edge can be studied |
| Show code | Reveals the simulated loop with the live delay value |
| Sleep delay | Sets the sleep() argument from 0.05 s to 2.0 s |
Lesson Plan
Grade Level
Undergraduate (college junior/senior) or advanced high school
Duration
10 minutes
Prerequisites
- Familiarity with a
whileloop - The idea that a digital output pin has only two voltage states
Learning Objective
Students will be able to calculate the blink frequency produced by a given
sleep() argument and demonstrate the relationship by predicting the wave
shape before changing the slider.
Activities
- Predict (3 min): Given
sleep(0.25), students write down the expected blinks per second before running the sim. - Test (4 min): Students set the slider to 0.25 s, run, and compare the readout to their prediction. Repeat for 1.0 s and 0.05 s.
- Step through (3 min): Using Toggle Once, students trace one full cycle and articulate why two toggles are needed per blink.
Assessment
Ask students to name the delay that produces exactly 5 blinks per second (answer: 0.1 s) and to justify the factor of two.
Related Resources
References
- Raspberry Pi Pico Python SDK — official MicroPython documentation for the Pico family.
- MicroPython machine.Pin documentation — the
toggle()and pin-state API being simulated here.