-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_AlarmClock.py
More file actions
42 lines (32 loc) · 873 Bytes
/
Copy pathtest_AlarmClock.py
File metadata and controls
42 lines (32 loc) · 873 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import time
import signal
import datetime
import threading
from alarm_clock import AlarmClock
from utilities import set_hw_volume
lock = threading.Lock()
clock = AlarmClock(lock)
up = True
def clean_exit(signum, frame):
global up
signal.signal(signal.SIGINT, original_sigint)
up = False
original_sigint = signal.getsignal(signal.SIGINT)
signal.signal(signal.SIGINT, clean_exit)
now = datetime.datetime.now()
clock.wakeup[now.weekday()] = ( datetime.time(now.hour, now.minute+1), "song.mp3" )
clock.alarm_enabled = True
clock.ringed_today = False
clock.number_of_wakeup_songs = 2
clock.volume_rampup_time = 20
set_hw_volume(30)
clock.message([0x01, 0xC1, 0x00, 0x3E, 0x73], 3)
time.sleep(2)
clock.set_brightness(6)
while up:
alarm = clock.update()
if alarm == True:
print "WAKE UP!"
time.sleep(0.2)
clock.shutdown()
time.sleep(0.2)