Translate one-character serial commands into four LED outputs. This introduces
Serial.available(), Serial.read(), functions, and a safe default state.
Connect each pin through its own 220–330 Ω resistor to an LED anode; connect each LED cathode to ground.
| Meaning | Uno pin |
|---|---|
| Up | 2 |
| Left | 3 |
| Right | 4 |
| Down | 5 |
Q = up-left, E = up-right, Z = down-left, C = down-right, and X (or
any unknown character) = off.
- Send every documented command once.
- Confirm the two expected LEDs and serial message.
- Send an unknown character and confirm all LEDs turn off.
- Leave the sketch idle and confirm it does not repeatedly print.
Add W, A, S, and D for single-direction output without duplicating the
pin-writing logic.