-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
executable file
·53 lines (36 loc) · 1.25 KB
/
Copy pathexample.py
File metadata and controls
executable file
·53 lines (36 loc) · 1.25 KB
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
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/python
from datetime import datetime
import time
from SparkFun_RV8803 import rtc
def main():
now = datetime.now()
print("RTC Begin: ", rtc.begin())
rtc.clearAllInterruptFlags()
rtc.disableAllInterrupts()
print(rtc.setTimeAll(now.second, now.minute, now.hour, now.weekday(), now.day, now.month, now.year))
rtc.updateTime()
print("%s/%s/%s %s:%s:%s" % (
rtc.getYear(),
rtc.getMonth(),
rtc.getDate(),
rtc.getHours(),
rtc.getMinutes(),
rtc.getSeconds()
))
rtc.setItemsToMatchForAlarm(True, False, False, False) # Match only to minute hand
rtc.setAlarmMinutes(42) # Match to 0 minutes each hour
rtc.enableHardwareInterrupt(3)
#rtc.setCountdownTimerEnable(True)
#print(rtc.setCountdownTimerClockTicks(10))
#print(rtc.getCountdownTimerClockTicks())
#print(rtc.stringDateUSA())
#print(rtc.getCountdownTimerEnable())
#print(rtc.setCountdownTimerEnable(True))
#time.sleep(1)
#print(rtc.getCountdownTimerEnable())
print(rtc.setHundredthsToZero())
time.sleep(2)
print(rtc.getInterruptFlag(3))
rtc.close()
if __name__ == "__main__":
main()