#include <Servo.h>
Servo night_wing;
Servo night_body;
Servo windup_wing;
Servo windup_key;
int windup_eye = 3;
void setup() {
night_wing.attach(11);
night_wing.write(0);
night_body.attach(10);
night_body.write(0);
windup_wing.attach(6);
windup_wing.write(0);
windup_key.attach(5);
windup_key.write(0);
pinMode(windup_eye, OUTPUT);
digitalWrite(windup_eye, LOW);
}
void loop() {
for (int i = 0; i < 3; i++) {
windup();
windup();
delay(7200);
}
nightingale();
nightingale();
delay(3600);
}
// 3600 seconds to run
void windup() {
for (int i = 0; i < 90; i++) {
windup_wing.write(i);
windup_key.write(i);
if (i % 10 == 0) {
digitalWrite(windup_eye, HIGH);
} else {
digitalWrite(windup_eye, LOW);
}
delay(10);
}
for (int i = 90; i >= 0; i--) {
windup_wing.write(i);
windup_key.write(i);
if (i % 10 == 0) {
digitalWrite(windup_eye, HIGH);
} else {
digitalWrite(windup_eye, LOW);
}
delay(10);
}
digitalWrite(windup_eye, LOW);
}
void nightingale() {
for (int i = 0; i < 120; i++) {
night_wing.write(i);
delay(10);
}
for (int i = 120; i >= 0; i--) {
night_wing.write(i);
delay(10);
}
for (int i = 0; i < 130; i++) {
night_body.write(i);
delay(10);
}
for (int i = 180; i >= 0; i--) {
night_body.write(i);
delay(10);
}
}
Click to Expand
Content Rating
Is this a good/useful/informative piece of content to include in the project? Have your say!
You must login before you can post a comment. .