ContentsIndex
Example
Servo Class
#include <Servo.h>
Servo myservo;
 
int potpin = 0;
int val;
 
void setup()
{
  myservo.attach(9);                // The servo connecting to pin 9.
}
 
void loop()
{
  val = analogRead(potpin);         // Reads from Pot pin.
  val = map(val, 0, 1023, 0, 180);  // Map value from 0~1023 to 0~180.
  myservo.write(val);               // The control servo.
  delay(200);
}