• Happy holidays, folks! Thanks to each and every one of you for being part of the Tom's Hardware community!

Using the time in python

Status
Not open for further replies.

Harry_77

Commendable
Sep 16, 2016
11
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".
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
Status
Not open for further replies.

TRENDING THREADS