Arduino

Buy | Download | Getting Started | Learning | Reference | Hardware | FAQ

Blog » | Forum » | Playground »

Reference Language (extended) | Libraries | Comparison | Board

Servo

## write()

#### Description

Writes an angle to the servo, moving the shaft to that orientation.

#### Syntax

servo.write(angle)

#### Parameters

servo: a variable of type Servo

angle: the angle to write to the servo, from 0 to 180 degrees

#### Example

    #include <Servo.h>

    Servo myservo;

    void setup()
    {
      myservo.attach(9);
      myservo.write(90);
    }

    void loop() {}

#### See also

- read()

Reference Home

Corrections, suggestions, and new documentation should be posted to the Forum.

The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.

Edit Page | Page History | Printable View | All Recent Site Changes