-- Callback function which is called when the button is pressed
function shutdown()
-- Shut down Windows or the Raspberry Pi
shut_down("SYSTEM")
end
hw_button_add("RPI_V2_P1_36", shutdown)
I want to put dedicated switch to shutdown the RPI.
SimPassion wrote: ↑Wed Oct 09, 2019 6:45 am
No problem with this @Utingbato
if any issue rename the function like this or anything else (I don't know if shutdown is an internal reserved word)
Sling wrote: ↑Thu Oct 10, 2019 3:00 am
Is the instrument this code is part of loaded to the Rpi and is the instrument running when you press the shutdown button.
Yes its loaded to the instrument and running with the same instrument in rpi.
Your first step would be to put a print in your function and see if it really triggers the function when you press the button. Then you know that it is not hardware related.
Ralph wrote: ↑Thu Oct 10, 2019 6:52 am
Your first step would be to put a print in your function and see if it really triggers the function when you press the button. Then you know that it is not hardware related.
If you want to do a similar thing but while running on the Rpi you could use visible to show or hide any image in response to the button press and release. I'd try the print as Ralph suggests first though. You will need to run in Create/Edit to see the print result.
Ralph wrote: ↑Thu Oct 10, 2019 6:52 am
Your first step would be to put a print in your function and see if it really triggers the function when you press the button. Then you know that it is not hardware related.
ok i'll try. then report back.
If you want to do a similar thing but while running on the Rpi you could use visible to show or hide any image in response to the button press and release. I'd try the print as Ralph suggests first though. You will need to run in Create/Edit to see the print result.