Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import os
- with open("/sys/class/i2c-adapter/i2c-2/2-0070/pwm/pwmchip9/pwm-9:0/enable", "w") as a:
- a.write = int(0)
- time.sleep(2)
- a.write = int(1)
- with open("/sys/class/i2c-adapter/i2c-2/2-0070/pwm/pwmchip9/pwm-9:0/period", "w") as b:
- b.write = int(10000000)
- with open("/sys/class/i2c-adapter/i2c-2/2-0070/pwm/pwmchip9/pwm-9:0/duty_cycle", "w") as c:
- c.write = int(1000000)
- try:
- angle = int(input("0 to 180: "))
- if True:
- if angle == 0 or angle == 45:
- time.sleep(3)
- a.write = int(1)
- b.write = int(10000000)
- c.write = int(2000000)
- elif angle == 90 or angle == 135:
- time.sleep(3)
- a.write = int(1)
- b.write = int(10000000)
- c.write = int(1500000)
- else:
- time.sleep(2)
- a.write = int(1)
- b.write = int(10000000)
- c.write = int(1000000)
- if not True:
- a.write = int(0)
- except:
- KeyboardInterrupt
- print("Hello, you have exited the program.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement