Let’s see how to control LED from the terminal.
In this tutoriel we are going to:
- Control the ACT LED on the Raspberry Pi.
- Plug a LED
- Control a LED from the terminal
|LED||5.93$ — 3.5$|
|Resistor||10.95$ – 3.64$|
|Breadboard||2.8$ – 1.21$|
|Dupont cables male/female||1.96$ – 1.25$|
|Total :||21.64$ – 9.6$|
Control the ACT led
By default, the green led (ACT led) light up when data is read or write on the SD card.
Here is how to control it :
- Turn on LED: /pi/ledOn
- Turn off LED: /pi/ledOff
- Blink LED: /pi/ledBlink
- Return LED to normal state: /pi/ledReset
We are going to plug our first led on pin 21, This is the pin near the USB port.
- Wire the LED + (the longest leg) on pin 21
- Wire the LED – on a (at least 100 ohms) resistor
- Wire the resistor to the ground, next to pin 21.
To install led module type:
Here are the commands to control a led on pin 21 :
- Turn on LED: /do/led/on 21
- Turn off LED: /do/led/off 21
- Blink LED: /do/led/blink 21
- Change led intensity: /do/led/pulse 21
- Display state of led (0:off 1:on): /do/led/state 21
- Display gpio: /show/gpio