Reference for Wiring version 1.0 Build 0100+ If you have a previous version, use the reference included with your software. If see any errors or have any comments, let us know.
Class | Servo |
||
---|---|---|---|
Name | read() |
||
Examples | #include <Servo.h> int myled = 8; Servo myservo; void setup() { pinMode(myled, OUTPUT); // set off the LED digitalWrite(myled, LOW); // attaches a servo connected to pin 2 myservo.attach(2); } void loop() { // sets the servo position at 180 degrees myservo.write(180); // if servo position is greater than 90 degrees if (myservo.read() >= 90) { // turn on the LED digitalWrite(myled, HIGH); } } |
||
Description | The read() method returns the actual servo motor position in degrees. | ||
Syntax | servo.read()
|
||
Parameters |
|
||
Returns | int | ||
Usage | Application |