Exercise C: Adaptation Challenge
~15 min
No step-by-step instructions. No hints. Just you and the documentation.
The Challenge
Combine what you've learned to build something that uses a configuration or control method you haven't tried yet. Here are some ideas — pick one or come up with your own:
Option 1: Level-Matched Response
Use get_level() on both the button and the LED's output state (is_set_high()) to create logic:
- If LED is already on and button is pressed → turn it off
- If LED is off and button is pressed → turn it on
- Basically: toggle on press, not just mirror the button state
Option 2: Configuration Explorer
Try every configuration option you can find in the docs:
- All
DriveStrengthvariants - Open-drain mode (does it work without external pull-up?)
- Different
Pullsettings on the input - What happens with
Pull::None(floating input)?
Option 3: Multi-Pin
Use multiple GPIO pins:
- Blink two LEDs alternately
- Use two buttons to control different behaviors
- Map different pins to different outputs
Resources
Everything you need is in the documentation:
- esp_hal::gpio module
- Your uFerris pinout card
- The Create → Configure → Control pattern
When You're Done
You've now experienced the full cycle: working example → docs exploration → independent adaptation. This is the same workflow we'll use for I2C and interrupts.
Take a break — lunch is next!