Shutdown button with moitessier hat - Printable Version +- OpenMarine (https://forum.openmarine.net) +-- Forum: OpenPlotter (https://forum.openmarine.net/forumdisplay.php?fid=1) +--- Forum: How do I...? (https://forum.openmarine.net/forumdisplay.php?fid=3) +--- Thread: Shutdown button with moitessier hat (/showthread.php?tid=1668) |
Shutdown button with moitessier hat - luchin0 - 2019-02-06 I'd like to have the possibility to have a momentary pusch that can shutdown all the program and the raspberry. In this way before turn off the power, i can shutdown the raspy in a very simple way. I have set the moitessier hat and i don't know if there is some free GPIO that i can use for this purpose. Thank you RE: Shutdown button with moitessier hat - luchin0 - 2019-02-11 what I understand, from the users guide of the moitessier hat, is that the gpio 5 and 6 of the rspi is not used by moitessier hat, so I can use one. I found a modification of the config.txt file, that should be ok for my purpose: Code: dtoverlay=gpio-shutdown,gpio_pin=5 So I have to connect (soldering?) the temporary switch to gpio 5 and ground, modifing the config.txt file, and everything should work correcly. Anyone can tell me if this is going to work or not? RE: Shutdown button with moitessier hat - luchin0 - 2019-04-24 I found a solution for my porpouse at thins link: https://bre.is/bDYg9gcsL Everythings work great if i start the python script with the command "sudo python3 shutdown.py" How can i make the script loading directly during the startup, without have to lunch the program from the shell everytime? Cheers RE: Shutdown button with moitessier hat - jim321 - 2019-04-24 on your link Step 5: Activate On Startup ? it might be easier to use nano rather than leafpad sudo nano /etc/rc.local (before exit 0 in the code) add the following: sudo python3 /home/shutdown.py & ctrl x y enter reboot Shutdown button with moitessier hat - luchin0 - 2019-04-24 Thankyou for the reply. It's what i made but didn't work. Sorry for ny bad english and thank you for the help Inviato dal mio ANE-LX2 utilizzando Tapatalk RE: Shutdown button with moitessier hat - jim321 - 2019-04-24 try giving it permissions sudo chmod 755 shutdown.py oops..maybe.... sudo chmod 755 python3 shutdown.py may need reboot Shutdown button with moitessier hat - luchin0 - 2019-04-25 I try what you suggest, but, as you see in the photo below, the correct sintax is without python3 or python, but nothing happen. In the second photo you see it in function, after pressing the button. What can i try? Inviato dal mio ANE-LX2 utilizzando Tapatalk RE: Shutdown button with moitessier hat - luchin0 - 2019-04-26 Done. follow this step: https://bre.is/CVB_1qr2R Attention at step 5: activate on sturt up "In order to make the shutdown button 'active' when your Raspberry Pi starts up, you need to include it in an rc.local script. Open a new terminal and type sudo nano /etc/rc.local This will open the Leafpad editor, with the rc.local file loaded. At the end of the file (before exit 0 in the code) add the following: sudo python3 /home/pi/shutdown.py & Save the file and exit nano. STEP 6 sudo chmod 755 shutdown.py Reboot the system. Thank you jim321 for the suggestions |