Hilscher Community Forum
Enable/Disable LED1 and LED2 - Printable Version

+- Hilscher Community Forum (https://forum.hilscher.com)
+-- Forum: netPI 3 - Docker featuring Industrial Raspberry Pi 3 platform (https://forum.hilscher.com/forum-1.html)
+--- Forum: Software (https://forum.hilscher.com/forum-5.html)
+--- Thread: Enable/Disable LED1 and LED2 (/thread-159.html)



Answer - FrankJacob - July-3rd-2018

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



Answer - Armin@netPI - July-5th-2018

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.


RE: Answer - hannes - August-23rd-2018

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


RE: Answer - Armin@netPI - August-23rd-2018

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


RE: Answer - hannes - August-23rd-2018

(August-23rd-2018, 09:04 AM)Armin@netPI Wrote: 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


----------------------
Hi Armin,

i mean the change of the file "/sys/class/leds/user0:orange:user/brightness".
But now i got it. The problem was that i dont turned "priviledge mode". Thanks a lot.

BR
Hannes