So this is the sketch,
#include<Servo.h>
Servo cont1;
Servo cont2;
//Servo head;
int sensePin = A0;
int tenin = 230;
int twenin = 100;
void setup()
{
cont1.attach(10);
cont2.attach(11);
//head.write(90);
//head.attach(9);
//pinMode(9 OUTPUT);
}
void loop()
{
cont1.write(135);
cont2.write(45);
delay(500);
if(analogRead(sensePin)<tenin)
{
cont1.write(92);
cont2.write(92);
delay(5000);
cont1.write(45);
cont2.write(135);
delay(500);
//head.write(90);
}
//head.write(0);
else(analogRead(sensePin)<twenin);
{
cont1.write(180);
cont2.write(180);
delay(500);
}
if(analogRead(sensePin)>tenin)
{
cont1.write(45);
cont2.write(135);
}
}
(The commented parts are the pats I took out because my servo broke
)
If you need me to post more i will