Shutdown button

Feb 6, 2019 - 7:58 PM

  • This is on my todo list. I have the breakout board and would like to wire up a switch on a GPIO that will do a shutdown -H. I think this will be my starting point:

    It would also be helpful to have one of the GPIO LEDs on the breakout board blink while the OS is up. Probably a script can be done for that without too much work as well.

    If I can translate these thoughts to action and code, I'll update the thread. But if someone beats me to it, please share here.

  • A quick way to get the green LED on the breakout board to blink after startup is to create a script such as the following (will turn green LED on/off for about 30 seconds) and have it run after boot is complete. Assuming that you are using the stock lubuntu install that comes on the board this can be accomplished by creating an /etc/rc.local file and making it readable/executable via: sudo chmod 755 /etc/rc.local

    The contents of the rc.local file should be along the lines of:



    exit 0

    The contents of /home/atomicpi/ would be:

    /bin/echo 332 > /sys/class/gpio/export
    /bin/echo out > /sys/class/gpio/gpio332/direction

    while [ $timer -lt 16 ]
    /bin/echo 0 > /sys/class/gpio/gpio332/value
    /bin/sleep 1
    /bin/echo 1 > /sys/class/gpio/gpio332/value
    /bin/sleep 1
    let timer=timer+1

    don't forget to: chmod 755 /home/atomicpi/

    I'm sure the above isn't anything new to most and I've added some steps that would be very obvious to those that have Linux experience, but in case there are some that are new to Linux and SBCs I thought I'd include the obvious things like changing file permissions.

    This post was edited Feb 7, 2019 05:14PM