Circuit:-
Code:-
#include<Servo.h>
int IR1 = 10;
Servo servo1;
Servo servo2;
void setup() {
pinMode(IR1,INPUT);
servo1.attach(8);
servo2.attach(9);
servo2.write(0);
servo1.write(180);
delay(1000);
}
void loop() {
if(digitalRead(IR1)==LOW)
{
servo2.write(90);
servo1.write(0);
delay(3000);
}
else
{
servo2.write(0);
servo1.write(120);
}
}
You can purchase the raw material for this project from herre:-
https://amzn.to/3nU8bxB
https://amzn.to/2L00cjO
https://amzn.to/37Rjp0p
No comments:
Post a Comment