Restart/Shutdown with Gertboard Pushbuttons - Raspberry Pi Forums
i have gertboard rev1 , wondering if there easy way make pushbuttons serve restart button and/or halt button.
have managed open buttons.c (from gertboard_sw package) loops , checks button gpio status ... , can determine pushbutton pressed i'm not sure how reboot/halt system in c. i'd 'shutdown -r now' if 1 button pressed, , 'shutdown -h now' if pressed.
extremely useful running headless raspi.
have managed open buttons.c (from gertboard_sw package) loops , checks button gpio status ... , can determine pushbutton pressed i'm not sure how reboot/halt system in c. i'd 'shutdown -r now' if 1 button pressed, , 'shutdown -h now' if pressed.
extremely useful running headless raspi.
the simplest execute command using 'system'.
system("this command executed");
in case:
system("sudo shutdown -r now");
need program running in loop detect buttons.
(you had better put 'sleep' in loop else uses 100% cpu time)
there interrupt code gpio pins more elegant solution.
don't know is.
system("this command executed");
in case:
system("sudo shutdown -r now");
need program running in loop detect buttons.
(you had better put 'sleep' in loop else uses 100% cpu time)
there interrupt code gpio pins more elegant solution.
don't know is.
raspberrypi
Comments
Post a Comment