I have a question. I want to have a python program running constanlty in background that is sending some data over serial to microcontroller. What i want to do is to send a special message when my pc is turning off. Is it possible to do so?
Asked
Active
Viewed 488 times
2
-
Is it enough to send a message when python is closed? Otherwise, we need OS info. – MegaIng Apr 17 '21 at 14:00
-
1If you are on windows, the answer is probably here: https://stackoverflow.com/questions/1411186/python-windows-shutdown-events and/or https://stackoverflow.com/questions/16145516/detecting-computer-program-shutdown-in-python – MegaIng Apr 17 '21 at 14:01
-
I dont understand most of what is happening in this links that u provided :( . I want to run it on Windows 10. Can you give me some example code please? and yes sending message is all i want to do. – loloToster Apr 17 '21 at 16:10
-
No, I mean do you need to detect Computer shutdown, or is Program ending enough? The second one is really simple to do. – MegaIng Apr 17 '21 at 16:12
-
I need to detect computer shut down because my program is a loop that never ends – loloToster Apr 17 '21 at 16:15
-
So does anyone have an idea? @MegaIng? – loloToster Apr 18 '21 at 13:43