Controlling Servos while Driving Remotely
import Fusion
import time
f = Fusion.driver()
usb = Fusion.usbGamepad()
f.servoEnable(f.S0, 1)
while True:
#drive code
y = usb.readAxis(1)
spin = usb.readAxis(2)
f.motorSpeed(f.M0, y - spin)
f.motorSpeed(f.M1, y + spin)
#servo control with buttons
if(usb.readButton(0)):
f.servoTarget(f.S0, 100)
elif(usb.readButton(1)):
f.servoTarget(f.S0, 200)
Continuous Rotation Servos
Position
Behavior
Last updated