Using the time in python

Harry_77

Commendable
Sep 16, 2016
4
0
1,510
0
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?
 

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".
 

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".
 
Thread starter Similar threads Forum Replies Date
A Apps General Discussion 5
T Apps General Discussion 5
A Apps General Discussion 4
A Apps General Discussion 4
A Apps General Discussion 1
R Apps General Discussion 1
M Apps General Discussion 1
A Apps General Discussion 1
G Apps General Discussion 5
M Apps General Discussion 11
A Apps General Discussion 6
G Apps General Discussion 19
C Apps General Discussion 1
Jaakey Apps General Discussion 2
T Apps General Discussion 3
B Apps General Discussion 4
R Apps General Discussion 1
D Apps General Discussion 6
G Apps General Discussion 3
shoob0x Apps General Discussion 3

ASK THE COMMUNITY