Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import board
- import busio
- import decimal
- import adafruit_pca9685
- import time
- import datetime
- from random import randint
- i2c = busio.I2C(board.SCL, board.SDA)
- hat = adafruit_pca9685.PCA9685(i2c)
- hat.frequency = 60
- clockSeconds = hat.channels[2]
- clockMinutes = hat.channels[1]
- clockHours = hat.channels[0]
- now = datetime.datetime.now()
- s = int(1091.666666667*(now.second))
- m = int(1091.666666667*(now.minute))
- h = int(5458.33*(int(now.strftime("%-I"))))
- clockHours.duty_cycle = h
- vs = s
- while True:
- now = datetime.datetime.now()
- clockSeconds.duty_cycle = s
- vs = vs + 136.4583375
- s = int(vs)
- time.sleep(0.125)
- if s >= 64408:
- now = datetime.datetime.now()
- m = int(1091.666666667*(now.minute))
- s = int(1091.666666667*(now.second))
- h = int(5458.33*(int(now.strftime("%-I"))))
- clockMinutes.duty_cycle = m
- clockHours.duty_cycle = h
- vs = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement