Advertisement
silver2row

pwm_control of i2c

Oct 4th, 2022
989
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. #!/usr/bin/python3
  2.  
  3. from PCA96xx import *
  4. from time import sleep
  5.  
  6. i2c_bus = SMBus("/dev/i2c-2")
  7. pwm_controller = PCA9685(i2c_bus, 0x34)
  8.  
  9. def servo():
  10.   angle = int(input("Please enter a value from 0 to 90: "))
  11.   if pwm_controller >= 1 and pwm_controller >= 90:
  12.     angle = pwm_controller
  13.   print ("Your Angle is: %d" % pwm_controller)
  14.  
  15. servo()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement