Arduino mad scientist laboratory EP #3 kitty cat laser tower toy

 

ARDUINO CODE:

#include <Servo.h>
Servo s1; //servo side to side
Servo s2; //servo up and down
int s1pos; //servo s1 angle
int s2pos; //servo s2 angle
int s1Low = 10; //servo s1 low
int s1High = 170; //servo s1 high
int s2Low = 95; //servo s2 low
int s2High = 150; //servo s2 high
int delayLow = 100; //short delay
int delayHigh = 1000;//long delay
int del; //delay time
void setup() {
s1.attach(3);
s2.attach(5);
// s1.write(90); // set up servos
// s2.write(90);
// delay(60000);
}

void loop() {
s1pos = random(s1Low, s1High);
s1.write(s1pos);
del = random(delayLow, delayHigh);
delay(del);
s2pos = random(s2Low, s2High);
s2.write(s2pos);
del = random(delayLow, delayHigh);
delay(del);
s2pos = random(s2Low, s2High);
s2.write(s2pos);
del = random(delayLow, delayHigh);
delay(del);
s1pos = random(s1Low, s1High);
s1.write(s1pos);
del = random(delayLow, delayHigh);
delay(del);
s2pos = random(s2Low, s2High);
s2.write(s2pos);
del = random(delayLow, delayHigh);
delay(del);
s1pos = random(s1Low, s1High);
s1.write(s1pos);
del = random(delayLow, delayHigh);
delay(del);
s2pos = random(s2Low, s2High);
s2.write(s2pos);
del = random(delayLow, delayHigh);
delay(del);
s2pos = random(s2Low, s2High);
s2.write(s2pos);
del = random(delayLow, delayHigh);
delay(del);
s2pos = random(s2Low, s2High);
s2.write(s2pos);
del = random(delayLow, delayHigh);
delay(del);
s1pos = random(s1Low, s1High);
s1.write(s1pos);
del = random(delayLow, delayHigh);
delay(del);
s1pos = random(s1Low, s1High);
s1.write(s1pos);
del = random(delayLow, delayHigh);
delay(del);
s2pos = random(s2Low, s2High);
s2.write(s2pos);
del = random(delayLow, delayHigh);
delay(del);
s2pos = random(s2Low, s2High);
s2.write(s2pos);
del = random(delayLow, delayHigh);
delay(del);
s1pos = random(s1Low, s1High);
s1.write(s1pos);
del = random(delayLow, delayHigh);
delay(del);
s2pos = random(s2Low, s2High);
s2.write(s2pos);
del = random(delayLow, delayHigh);
delay(del);
s1pos = random(s1Low, s1High);
s1.write(s1pos);
del = random(delayLow, delayHigh);
delay(del);
s1pos = random(s1Low, s1High);
s1.write(s1pos);
del = random(delayLow, delayHigh);
delay(del);
s2pos = random(s2Low, s2High);
s2.write(s2pos);
del = random(delayLow, delayHigh);
delay(del);
s2pos = random(s2Low, s2High);
s2.write(s2pos);
del = random(delayLow, delayHigh);
delay(del);
s2pos = random(s2Low, s2High);
s2.write(s2pos);
del = random(delayLow, delayHigh);
delay(del);
s1pos = random(s1Low, s1High);
s1.write(s1pos);
del = random(delayLow, delayHigh);
delay(del);
s1pos = random(s1Low, s1High);
s1.write(s1pos);
del = random(delayLow, delayHigh);
delay(del);

}