Exercise A: Blinky
~15 min
Goal
Get an LED blinking on the uFerris board by finding and adapting an existing example from the esp-hal documentation.
Steps
1. Create a New Project
esp-generate --chip esp32c3 -o unstable-hal -o vscode -o esp-backtrace -o log --headless gpio_blinky
cd gpio_blinky
2. Find the Example
Navigate to the esp-hal GPIO documentation.
Look for a blinky example — check:
- The module-level documentation (
esp_hal::gpio) - The
Outputstruct page - The esp-hal examples directory on GitHub
3. Apply the Mental Model
Read the example and identify:
- Instantiate — How is the
Outputcreated? What arguments does it take? - Configure — What configuration is applied? (Level, OutputConfig)
- Control — What method is used to change the LED state?
4. Adapt to uFerris
- Check your pinout card for the LED pin on the uFerris board
- Update the GPIO pin in the example to match
- Make sure the initial level matches your hardware (active high or active low?)
5. Build and Flash
cargo build --release
espflash flash target/riscv32imc-unknown-none-elf/release/blinky --monitor
Verify: the LED should blink at a steady rate.
What to Notice
- The
Output::new()call combines Instantiate and Configure in one statement - Look at what other methods
Outputprovides besides the one used in the example