Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import time
- os.system("sudo pigpiod") #launch GPIO library
- time.sleep(1)
- import pigpio
- ESC = 4
- # white wire to 4 (7)
- # black wire to 23 (6)
- pi = pigpio.pi();
- pi.set_servo_pulsewidth(ESC, 0)
- max_value = 2500
- min_value = 500
- def control():
- print "Starting motor"
- time.sleep(1)
- speed = 1900
- while True:
- pi.set_servo_pulsewidth(ESC, speed)
- def arm():
- print "Connect battery and press Enter"
- inp = raw_input()
- if inp == '':
- pi.set_servo_pulsewidth(ESC, 0)
- time.sleep(1)
- pi.set_servo_pulsewidth(ESC, max_value)
- time.sleep(1)
- pi.set_servo_pulsewidth(ESC, min_value)
- time.sleep(1)
- control()
- print "Starting..."
- arm()
Add Comment
Please, Sign In to add comment