Inicio » Example 2

Example 2

With this program you move a servomotor (connected to pin 11) from angle 90º to angle 180º each three seconds:

#include <Servo.h>

Servo john;

void setup()
{
pinMode(11, OUTPUT);
john.attach(11);
}

void loop()
{
john.write(90);
delay(3000);
john.write(180);
delay(3000);
}