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
Prerequisite: Piget

Needed components

Composants Prix Liens
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

led Act

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
Plug a led


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.

schema Led 21

If you want to plug a led on another pin here is a list on pinout.xyz
How to find the right resistor for a led?
Control a led on the terminal

To install led module type:

/pi/install led

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
You can use additional arguments on some commands.
Others ressources
Comments are closed.