Hey there,
can someone tell me the command i have to use in a shell script to enable/disable the LED1 and LED2?
I tried to set the GPIO12 to high, but this doesn't work.
Frank
July-5th-2018, 10:48 AM
(This post was last modified: January-4th-2019, 05:51 PM by Armin@netPI.)
Frank, physically these LEDs are connected physically to GPIO12 and GPIO13.
In netPI's host Linux these pins are not created as
gpio devices but as
led devices by default. (It does not make sense to program them as GPIOs since they are outputs always, so we decided to let the Linux creating them as LEDs.)
So instead of echoing in a console to
/sys/class/gpio for example you have to use the path
/sys/class/leds.
Under this path you find 4 LEDs:
led0,
led1,
user0:orange:user,
user1:orange:user
So to light up the 1st orange LED in a console use
Code:
echo 1 | sudo tee /sys/class/leds/user0:orange:user/brightness
The same applies for the other LED.
„You never fail until you stop trying.“, Albert Einstein (1879 - 1955)
August-23rd-2018, 08:43 AM
I want to control the LEDs, too. To test it i started a container and connected via SSH. Is there a trick to change the content of the files? The CLI always says that his was a ready only file system. I know that docker is read-only. But how can i turn the LED on and off.
Thanks!
BR
Hannes
August-23rd-2018, 09:04 AM
(This post was last modified: January-4th-2019, 05:52 PM by Armin@netPI.)
Quote:Is there a trick to change the content of the files?
Hello Hannes,
just ask me which files you want to change exactly? And what is the purpose of changing the files?
For a short your should do the following:
I pulled the image "hilschernetpi/netpi-raspbian:latest" onto your netPI. Map the port 22 for SSH and enabled priviledge mode also.
Then login with user "pi" and password "raspberry" and as first command type in
Code:
echo 1 | sudo tee /sys/class/leds/user0:orange:user/brightness
You will see the LED2 going to state "on".
Regards
Armin
„You never fail until you stop trying.“, Albert Einstein (1879 - 1955)