Syntax
void write(
    int value
);
ContentsIndex
PreviousUpNext
Servo::write Method
Servo Class | Example
Syntax
void write(
    int value
);
Description

Writes a value to servo to control the corresponding lever. Sets up the lever angle for a standard servo motor in order to move the lever to the corresponding angle. To set up the rotation speed for a continuously rotating servo motor, use 0 to rotate in one direction in full speed; 180 to rotate in the opposite direction in full speed; and 90 to stay intact.

Parameters
Parameters 
Description 
int value 
The angle written to servo, 0 ~ 180. 
Returns

Void.

Example
#include <Servo.h>
 
Servo myservo;
 
void setup()
{
  myservo.attach(9);
  myservo.write(90);  // Sets servo to mid-point.
}
 
void loop() 
{
  
}
File

Servo.h

Class