Programming 3-Wire Servos

  1. 9 months ago

    I was wondering how do you code a 3-Wire servo for an arm control during driver control, is it the same code as a 393 motor?

  2. kypyro

    14 Feb 2018 V5 Beta Tester Central Kentucky

    Well, mostly. You can either use the port as though it has a motor attached, and use your favorite way to control a motor:

    // treat servo port like a motor
    // set servo to most backward position
    motor[myServoPort] = -127
    // natural language method
    startMotor(myServoPort, -127);

    Or you can use the Natural Language function to set the servo position:

    // treat servo port as a servo
    // set servo to most backward position
    setServo(myServoPort, -127);

    Range is -127 to 127; zero is (obviously) the center position.


or Sign Up to reply!