Advertisement
silver2row

Bad start to a nice project

May 5th, 2020
1,467
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. from smbus2 import SMBus
  2. from ServoLib import Pca9685
  3. from time import sleep
  4.  
  5. i2c2 = SMBus("/dev/i2c-2")
  6. x = Pca9685(i2c2, 0b111111)
  7.  
  8. x.read_reg   = 0
  9. x.write_reg  = 0
  10. x.read_regs  = (0, 5)
  11. x.write_regs = (0, 0, 5)
  12. x.pwm_get = 0
  13. x.pwm_set = 0
  14.  
  15. angle = int(input("What would your favorite angle be now? "))
  16. if angle <= 180 or angle >=0:
  17.     angle = x.pwm_get
  18.     print("Your angle is ", angle)
  19.  
  20.     if angle is 45:
  21.         angle = x.pwm_set
  22.     print("The sustained angle is ", angle)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement