GPIO LEDS

Post Reply
sind
Posts: 1
Joined: Mon Jan 15, 2018 9:13 am

GPIO LEDS

Post by sind »

Hello,

I need to control the 2 GPIO LEDS in Linux.
Is necessary a specific driver to control them or I can simply control the GPIOs from "/sys/class/gpio"? If so which GPIOs are connected to the LEDS?

Regards

tamir
Site Admin
Posts: 419
Joined: Mon Dec 25, 2017 4:21 pm

Re: GPIO LEDS

Post by tamir »

In Linux kernel GPIOs related to the north part of the SOC numbered from 434:
GPIO_1 = 435
GPIO_2 = 436
GPIO_3 = 437
GPIO_4 = 438

You’ll Need to work as root (root password required):
$ su
Password:

To control gpio435 (GPIO_1, DS3 green LED on fitlet2):
$ echo 435 > /sys/class/gpio/export
$ echo out > /sys/class/gpio/gpio435/direction
$ echo 1 > /sys/class/gpio/gpio435/value
# DS3 green LED should be GREEN now
$ echo 0 > /sys/class/gpio/gpio435/value
# DS3 green LED should be OFF now
$ echo 435 > /sys/class/gpio/unexport

The GPIO framework and GPIO sysfs interface are documented in
https://www.kernel.org/doc/Documentation/gpio/gpio.txt

Post Reply

Return to “fitlet2 software”