[AIServo86]
Description
Read the Servo angle.
Syntax
servo.read()
Parameters
servo: Variable of the AIServo type.
Returns
The current angle of the servo, if the servo is not yet out, the return value is -1. (Unit: degree)
Example
#include <AIServo86.h>
AIServoPort(ROBOTIS, AX12) bus;
AIServo myservo;
double position;
void setup()
{
bus.begin(Serial1, 1000000);
myservo. attach(bus, 9);
myservo.write(90.0); // turn the servo to 90 degrees
delay(100); // delay by 100 milliseconds
position = read(); // read the current angle
Serial. println(position);
}
void loop() {}See also
Libraries Reference Home
The text of the 86Duino reference is a modification of the Arduino reference and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.