Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#include <Servo.h>
Servo lefty; // create servo object to control a servo
Servo righty; // a maximum of eight servo objects can be created
int leftEye = 13;
int rightEye = 11;
void setup()
{
lefty.attach(9); // attaches the servo on pin 9 to the servo object
righty.attach(7);
pinMode(leftEye, OUTPUT);
pinMode(rightEye, OUTPUT);
}
void loop()
{
lefty.write(180);
righty.write(180);
digitalWrite(leftEye, LOW);
digitalWrite(rightEye, LOW);
delay(1000);
lefty.write(0);
righty.write(0);
digitalWrite(leftEye, HIGH);
digitalWrite(rightEye, HIGH);
delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment