| Index

| Reference for Wiring 1.0 (ALPHA) 0019+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.

Name |  | ### read()
Examples |  |
    #include <Servo.h>

    int myled = 0;
    Servo myservo;

    void setup() {
      pinMode(myled, OUTPUT);
      digitalWrite(myled, LOW);  // set off the LED
      myservo.attach(2)  // attaches a servo connected to pin 2
                               // to the servo channel 0
    }

    void loop() {
      myservo.write(180);  // sets the servo position at 90 degrees
      if(myservo.read() >= 90)   // if servo position is greater than 90 degrees
      {
        digitalWrite(myled, HIGH);  // turn on the LED
      }
    }
Description |  | The read() method returns the actual servo motor position in degrees.
Syntax |  |
    servo.read()
Parameters |  |
servo |  | Any variable of type Servo
Returns |  | int
Usage |  | Application