Skip to content

Instantly share code, notes, and snippets.

@Hart87 Hart87/calibr8.py
Created Aug 21, 2019

Embed
What would you like to do?
Quick script to calibrate ESCs. Turn on flight controller after.
import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
#motors
GPIO.setup(21, GPIO.OUT)
GPIO.setup(20, GPIO.OUT)
GPIO.setup(26, GPIO.OUT)
GPIO.setup(19, GPIO.OUT)
pwm = GPIO.PWM(21, 100) #aft port motor - MOTOR 3
pwm.start(0)
pwm2 = GPIO.PWM(20, 100) #forward port motor - MOTOR 4
pwm2.start(0)
pwm3= GPIO.PWM(26, 100) # aft starboard motor - MOTOR 1
pwm3.start(0)
pwm4 = GPIO.PWM(19, 100) # forward starboard motor - MOTOR 2
pwm4.start(0)
#CALBR8SHUN
print('TURN IT ON HIGH')
for x in range(20):
print("plugin the battery.....")
pwm.ChangeDutyCycle(11)
pwm2.ChangeDutyCycle(11)
pwm3.ChangeDutyCycle(11)
pwm4.ChangeDutyCycle(11)
sleep(1) #20 seconds on the highest pulse
print('TURNING DOWN THE PULSE')
for i in range(11,3,-1): #PULSING DOWN TO THE WEAKEST. EXPECTING THE ARMING BEEP
print(i)
pwm.ChangeDutyCycle(i)
pwm2.ChangeDutyCycle(i)
pwm3.ChangeDutyCycle(i)
pwm4.ChangeDutyCycle(i)
sleep(0.04)
print("Arming beep????")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.