• 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Enable/Disable LED1 and LED2
#1
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
  Reply
#2
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)

  Reply
#3
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
  Reply
#4
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)

  Reply
#5
(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
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  [SOLVED] activate LED1/2 with Node-RED + fieldbus nodes container Christian_Rau 5 80 January-11th-2019, 08:06 AM
Last Post: Armin@netPI
  Access Denied to LED1 / LED2 crthomas1234 1 104 July-12th-2018, 04:36 PM
Last Post: Armin@netPI

Forum Jump:


Users browsing this thread: 1 Guest(s)