NeoPixel Button Lab
Review of Button Basics
Working with Two Buttons
Changing Color With Buttons
Using Modes
Our LED kit can run a single "main" loop forever. But we often want to have the main loop run a different subprogram. Each subprogram can be triggered by pressing a button. The button will update a variable and the main loop will use this variable to redirect the main to the appropriate function.
The mode
variable is traditionally used to store the current subprogram being run. You are not limited to a single mode. You can also have modes within modes.
- Using a buttons to advance a mode
- Using a two buttons to move to the next and previous mode
- Using two modes - one mode or each button