Interrupt Exercises
~30 min
Exercise A: GPIO Interrupts
Configure the existing GPIO input button example to use interrupts instead of polling.
- Check the
esp-halabstractions and code examples - See if you can find examples that you can adapt
- Apply the mental model: find the Instantiate, Configure, and Control steps for interrupt-driven GPIO
Exercise B: I/O Expander Interrupt
The TCA6424 I/O expander has an INT output connected to a Xiao GPIO pin. Use it to get notified of input changes instead of polling over I2C.
- Configure a GPIO interrupt on the INT pin
- When triggered, read the I/O expander over I2C to determine what changed
- This combines GPIO interrupts with I2C communication