Using the time in python

Harry_77

Commendable
Sep 16, 2016
4
0
1,510
i was just wondering how i can use use the time to trigger something to happen.
for example, i have a raspberry pi and i programmed 2 LEDs to come on when i press a button in python. How could i programme it so they come on at 8:00AM for example?
 
Solution
The typical way to implement something like this is to calculate the time between now and the desired time. Set a timer to wakeup the process, then put the process to sleep. With this implementation you don't use CPU cycles while "waiting".

kanewolf

Judicious
Moderator
The typical way to implement something like this is to calculate the time between now and the desired time. Set a timer to wakeup the process, then put the process to sleep. With this implementation you don't use CPU cycles while "waiting".
 
Solution