Servo

Servo

Methods


servo_attach(servo, pin)


Links the chosen Arduino pin to the given servo motor.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
servo

the servo to attach to the pin

pin

the pin to attach to the servo

Code Equivalent:
servo.attach(pin);

servo_attached(servo)


Returns true or false if the servo is attached to a pin.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
servo

the servo to check

Code Equivalent:
servo.attached()

servo_detach(servo)

Parameters:
Name Type Description
servo

the motor to detach

Code Equivalent:
servo.detach();

servo_read(servo)


Returns the current angle of the servo (the value last passed to servo_write)

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
servo

the motor to read the angle of

Code Equivalent:
servo.read()

servo_write(servo, angle)


Tells the given servo motor which angle to spin at.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
servo

which motor to write to

angle

the angle for the motor to be at

Code Equivalent:
servo.write(angle);

servo_write_microseconds(servo, micros)


Writes a value in microseconds to the servo, setting the angle of the shaft. 1000 is fully counter-clockwise, 2000 is fully clockwise, and 1500 is in the middle.

Check out the third party documentation for a more in depth explanation.

Parameters:
Name Type Description
servo

the servo motor to write to

micros

the number of microseconds to write to the servo

Code Equivalent:
servo.writeMicroseconds(micros);