Lesson 27: Awesome LEDs!
LEDs are useful because they let the robot communicate. They can show driver feedback, mechanism state, enabled status, target lock, or warnings without opening a dashboard.
Use LEDs for Information
Pretty lights are fun, but the best LED patterns help the team understand the robot faster.
- Green: ready to shoot.
- Red: sensor fault or unsafe state.
- Blue: target found.
- Yellow: waiting for calibration.
- Flashing: driver action needed.
Represent LED State in Code
enum LedState {
DISABLED,
READY,
HAS_TARGET,
ERROR
}
LedState ledState = LedState.DISABLED;Mechanisms can request LED states, and one LED class can decide what pattern to display.
Avoid Conflicting Messages
If every subsystem sets LEDs directly, the last one to run wins. Instead, decide which messages are most important. Errors might override target lock, and target lock might override normal enabled color.
Practice
Design an LED priority list for a shooter robot. Include at least four messages and decide which one wins if two are true at the same time.