Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from time import sleep
- from machine import Pin, PWM
- from machine import Pin
- led = Pin(25, Pin.OUT)
- pwm = PWM(Pin(0))
- pwm.freq(50)
- off = 3000
- fourtyfive = 5000
- seventy = 8000
- one_hour = 3600 # 3600 in prod 5 is test
- rotation_time = 3
- rotations_per_loop = 5
- # power reset unit at 20:00 to get extra hot water
- print("70")
- pwm.duty_u16(seventy)
- sleep(rotation_time)
- pwm.duty_u16(0)
- sleep(2*one_hour)
- print("off")
- pwm.duty_u16(off)
- sleep(rotation_time)
- pwm.duty_u16(0)
- # time was 22:00
- sleep(2*one_hour)
- while True:
- print("time is 00:00")
- sleep(2.5*one_hour)
- # time is 2:30
- pwm.duty_u16(fourtyfive)
- sleep(rotation_time) #1
- pwm.duty_u16(0)
- sleep(1*one_hour)
- # time is 3:30
- pwm.duty_u16(seventy)
- sleep(rotation_time) #2
- pwm.duty_u16(0)
- sleep(2*one_hour)
- # time is 05:30
- pwm.duty_u16(off)
- sleep(rotation_time) #3
- pwm.duty_u16(0)
- sleep(8*one_hour)
- # time is 13:30
- led.toggle()
- pwm.duty_u16(fourtyfive)
- sleep(rotation_time) #4
- pwm.duty_u16(0)
- sleep(1*one_hour)
- # time is 14:30
- led.toggle()
- pwm.duty_u16(off)
- sleep(rotation_time) #5
- pwm.duty_u16(0)
- sleep(9.5*one_hour - rotations_per_loop*rotation_time)
- # time is 00:00
Advertisement
Add Comment
Please, Sign In to add comment