GPIO Exercises

~50 min

Exercise A: Blinky

  1. Find the blinky example in the esp-hal GPIO documentation
  2. Identify the Instantiate, Configure, and Control steps
  3. Adapt the pin to match the uFerris LED pin (check your pinout card)
  4. Flash and verify — the LED should blink

Exercise B: Button Input

  1. Find the Input abstraction in the esp-hal GPIO documentation
  2. Configure it with pull-up (since the hardware button pulls to ground)
  3. Find the method that detects when the button is pressed (low)
  4. Modify your blinky to turn on the LED when the button is pressed
  1. Look into the Output documentation in esp-hal
  2. Find a different way to achieve the same blink behavior, without using the same approach as in Exercise A
  3. Modify your code to blink the LED using this alternative approach

Cross-HAL Comparison

How do other HALs handle GPIO? Navigate the documentation for these two libraries and find how they approach the same tasks:

Compare how each HAL handles Instantiate, Configure, and Control for GPIO.