Servo servo_window;
int sensor=A1;
int angle=0;
int sensor1=D4;
int sensor2=D2;
void setup() {
Serial.begin(9600);
servo_window.attach(D7);
pinMode(sensor1,OUTPUT);
pinMode(sensor2,OUTPUT);
}
void loop() {
for(angle=0;angle<90;angle+=1)
{
servo_window.write(angle);
delay(15);
}
int reading=analogRead(sensor);
if(reading>840 && reading<880)
{
digitalWrite(sensor1,HIGH);
Serial.println(reading);
}
if(reading>830 && reading<850)
{
digitalWrite(sensor2,HIGH);
Serial.println(reading);
}
}
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. .