From onboard to an external LED.
What is an LED?
An LED (Light Emitting Diode) is a small electronic component that makes light.
It lights up when current flows through it in the correct direction.
Remember our water wheel?
- The wheel works in one direction; the LED also has a correct direction.
- Voltage is like water pressure; current is like water flow.
- Too much current can damage the LED.
- A resistor is like a narrow pipe: it limits the flow of current.
Connect a regular LED.
Disconnect USB while wiring.
D13→220 Ω resistor→Long leg: positive (+)
Short leg: negative (−) → GND
The onboard resistor protects only the onboard LED. Our external LED needs its own resistor, even on pin 13.
Make the pin number explicit.
const int LED_PIN = 13;
On the Uno, LED_BUILTIN already means pin 13. Keep the rest of the touch-sensor code unchanged.
Reconnect USB → Check → Upload.
Touch the sensor and watch your LED.
The onboard LED will follow along too.