Libraries
\ Servo
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.
Name |
Servo |
Examples |
#include <Servo.h>
Servo myservo;
Servo mysecondservo;
void setup()
{
myservo.attach(3);
mysecondservo.attach(15);
}
void loop()
{
myservo.write(180);
mysecondservo.write(65);
}
#include <Servo.h>
Servo myservo;
void setup()
{
myservo.attach(2);
}
void loop()
{
myservo.write(90);
}
|
Description |
Class for controlling servo motors connected to the Wiring digital pins. |
Syntax |
Servo myservo
|
Methods |
attach() |
Attaches a servo motor to an i/o pin |
detach() |
Stops an attached servos from pulsing its i/o pin |
read() |
Gets the last written servo pulse width as an angle between 0 and 180 |
write() |
Sets the servo angle in degrees |
attached() |
Returns true if there is a servo attached |
readMicroseconds() |
Gets the last written servo pulse width in microseconds |
writeMicroseconds() |
Sets the servo pulse width in microseconds |
|
Returns |
None |
Usage |
Application |
Updated on July 07, 2011 11:11:29pm PDT