-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
40 lines (40 loc) · 996 Bytes
/
main.py
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
from machine import I2C,Pin
import time
i2c = I2C(1)
s =b'00000000'#0
m =b'00000000'#0
hour=b'00100010'#23
day =b'00000111'#7
date=b'00101000'#28
mes =b'00010010'#12
ano =b'00100011'#23
i2c.writeto_mem(104,0,s,addrsize=8)
time.sleep_ms(200)
i2c.writeto_mem(104,1,m,addrsize=8)
time.sleep_ms(200)
i2c.writeto_mem(104,2,hour,addrsize=8)
time.sleep_ms(200)
i2c.writeto_mem(104,3,day,addrsize=8)
time.sleep_ms(200)
i2c.writeto_mem(104,4,date,addrsize=8)
time.sleep_ms(200)
i2c.writeto_mem(104,5,mes,addrsize=8)
time.sleep_ms(200)
i2c.writeto_mem(104,6,ano,addrsize=8)
time.sleep_ms(200)
s1 =b'10000111'#7segundos
m1 =b'10000000'#0
hour1=b'10100010'#23
day1 =b'11000111'#7
i2c.writeto_mem(104,7,s1,addrsize=8)
time.sleep_ms(200)
i2c.writeto_mem(104,8,m1,addrsize=8)
time.sleep_ms(200)
i2c.writeto_mem(104,9,hour1,addrsize=8)
time.sleep_ms(200)
i2c.writeto_mem(104,10,day1,addrsize=8)
time.sleep_ms(200)
cont_reg=14
in=b'00000101'
i2c.writeto_mem(104,cont_reg,in,addrsize=8)
time.sleep_ms(300)