Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from smbus2 import SMBus
- from ServoLib import Pca9685
- from time import sleep
- i2c2 = SMBus("/dev/i2c-2")
- x = Pca9685(i2c2, 0b111111)
- x.read_reg = 0
- x.write_reg = 0
- x.read_regs = (0, 5)
- x.write_regs = (0, 0, 5)
- x.pwm_get = 0
- x.pwm_set = 0
- angle = int(input("What would your favorite angle be now? "))
- if angle <= 180 or angle >=0:
- angle = x.pwm_get
- print("Your angle is ", angle)
- if angle is 45:
- angle = x.pwm_set
- print("The sustained angle is ", angle)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement