LED module with TinkerPie
A single bright LED with its resistor.
| Type | Outputs and actuators |
|---|---|
| Connect to | any accessory pin |
| Gives | on / off or 0-100 % |
| Simulator | Yes: a control appears under the simulated board |
How it works
An LED (light-emitting diode) gives light when current flows through it the right way round. The module already includes the resistor that limits the current, so it is safe to connect straight to a pin.
How to wire it
Signal pin to S1-S4 or P10-P13. Motors, pumps and lamps always go through the relay or a driver module, never straight to a pin.
Code
In blocks: Accessories category in TinkerPie Studio. As code:
// JavaScript
outputs.led(Pin.S1, true)
outputs.ledBrightness(Pin.S1, 40)
// Arduino C++
outputs::led(Pin::S1, true)
outputs::ledBrightness(Pin::S1, 40) Good to know
- Switch it on and off, or set brightness 0-100 % with PWM.
- A bare LED always needs a resistor.
- Any accessory pin works.
Similar modules
- Relay module
- Traffic light module
- Laser module
- Active buzzer module
- DC fan / motor module (with transistor)
- 16-channel servo driver PCA9685
More projects to try
Questions
Can I try the LED module without buying one?
Yes. In TinkerPie Studio the simulator shows a control for it under the board, so you can test your program before you build it.
Why does an LED need a resistor?
Without one, too much current flows and the LED (and the pin) can be damaged. Try the "Oops! LED without a resistor" example in TinkerPieCircuit.