Servo Motor Reference
A standard hobby servo (e.g. SG90) that rotates to an absolute angle (typically 0°–180°) based on a PWM control signal.
Pin names
| Name | Description |
|---|---|
| GND | Ground |
| V+ | Power (5V) |
| PWM | Control signal — connect to a PWM-capable GPIO |
Attributes
This component has no configurable attributes.
Usage
Connect V+ to 5V, GND to GND, and PWM to a GPIO pin. Drive it with the built-in
Servo library, which handles the pulse timing.
#include <Servo.h>
Servo myServo;
const int SERVO_PIN = 9;
void setup() {
myServo.attach(SERVO_PIN);
}
void loop() {
myServo.write(0); // 0 degrees
delay(1000);
myServo.write(90); // 90 degrees
delay(1000);
myServo.write(180); // 180 degrees
delay(1000);
}
Servos can draw significant current under load — on real hardware, power multiple servos from a dedicated 5V supply rather than the Arduino's onboard regulator.
Examples
| Description | Attrs |
|---|---|
| Default servo | {} |
See also
- Buzzer — another common single-pin PWM-driven actuator
- Stepper Motor — continuous rotation with precise step control instead of an absolute angle