.Off( )

back to FEHServo

Description

This function is used to turn off a servo. It can be used when a servo is no longer required to hold an angle. By doing this, the battery life of the Proteus will be extended since current will no longer be sent to the servo. Be aware that this can cause servo arms or forklifts to fall spontaneously, so be careful not to damage the course, your Proteus, or other parts on your robot.

Parameters

None.

Returns

None.

Examples

#include <FEHServo.h>
//need FEHUtility.h for Sleep()
#include <FEHUtility.h>

#define SERVO_MIN 500
#define SERVO_MAX 2250

int main(void)
{
    //declares a servo on servo port 3
    FEHServo arm_servo(FEHServo::Servo3); 

    //enter the minimum and maximum servo values
    //from the .TouchCalibrate() function
    arm_servo.SetMin(SERVO_MIN);
    arm_servo.SetMax(SERVO_MAX);

    //set the servo angle to it's initial angle
    arm_servo.SetDegree(90.);
    
    //wait 5 seconds
    Sleep(5.0);

    //turn servo off
    arm_servo.Off();
}