Default color of the expansion onboard LED



  • I'd like to use the expansion's onboard LED to signal the state of the device, ie, show red when the device boots up, yellow just before my project is ran, and green when it's ready to accept input.

    How do I make the LED be red every time I start the device up?



  • You can run a command when system startup finishes by putting it in the /etc/rc.local script. This script will be run at the end of the boot process so it's also a good place to start up your script if you want it to run at boot.



  • Ok, sure that's kind of the earliest place where it could be set. But I was wondering if there's a way to set the color what it shows when the board is powered up. Currently it is light blue-ish.


  • administrators

    Hi @Pavils-Jurjans, modifying the behavior of the RGB LED is quite complicated, because it isn't a single configuration that you set. You need to turn the control of GPIOs 15, 16, and 17 to the kernel. This is done by changing the code in target/linux/ar71xx/files/arch/mips/ath79/mach-onion-omega.c in the buildroot. After that, you will see a new file under /sys/classes/led. After that you will be able to use configuration to change the color/behavior of the LED during boot.



  • @Pavils-Jurjans @Boken-Lin
    I saw a related question in this forum:
    https://community.onion.io/topic/273/omega-expansion-dock-led-turn-off

    I ended up creating a script that turns off the LED and can run during boot up.

    Here's what my turnoffled.sh looks like:

    #! /bin/ash
    fast-gpio set 15 1 #B
    fast-gpio set 16 1 #G
    fast-gpio set 17 1 #R
    

    Of course, one can also create a similar script to turn on the LED:

    #! /bin/ash
    fast-gpio set 15 0
    fast-gpio set 16 0
    fast-gpio set 17 0
    

Log in to reply
 

Looks like your connection to Onion Community was lost, please wait while we try to reconnect.