Advertisement
DamagedDolphin

Untitled

Jun 28th, 2020
2,282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.94 KB | None | 0 0
  1. import board
  2. import busio
  3. import decimal
  4. import adafruit_pca9685
  5. import time
  6. import datetime
  7. from random import randint
  8.  
  9. i2c = busio.I2C(board.SCL, board.SDA)
  10. hat = adafruit_pca9685.PCA9685(i2c)
  11.  
  12. hat.frequency = 60
  13.  
  14. clockSeconds = hat.channels[2]
  15. clockMinutes = hat.channels[1]
  16. clockHours = hat.channels[0]
  17.  
  18. now = datetime.datetime.now()
  19.  
  20. s = int(1091.666666667*(now.second))
  21. m = int(1091.666666667*(now.minute))
  22. h = int(5458.33*(int(now.strftime("%-I"))))
  23.  
  24. clockHours.duty_cycle = h
  25.  
  26. vs = s
  27.  
  28. while True:
  29.     now = datetime.datetime.now()
  30.     clockSeconds.duty_cycle = s
  31.     vs = vs + 136.4583375
  32.     s = int(vs)
  33.     time.sleep(0.125)
  34.     if s >= 64408:
  35.         now = datetime.datetime.now()
  36.         m = int(1091.666666667*(now.minute))
  37.         s = int(1091.666666667*(now.second))
  38.         h = int(5458.33*(int(now.strftime("%-I"))))
  39.  
  40.         clockMinutes.duty_cycle = m
  41.         clockHours.duty_cycle = h
  42.  
  43.         vs = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement