Automatic water dispenser using arduino UNO
CIRCUIT DIAGRAM :-
Code🔻
#include <Servo.h>
Servo Servo;
int ir_sensor = 8;
int servo_motor =7;
int val;
void setup()
{ pinMode(ir_sensor, INPUT);
Servo.attach(servo_motor);
}
void loop()
{ val = digitalRead(ir_sensor);
if (val==0)
{ Servo.write(0);
}
if (val==1)
{ Servo.write(90); }
}
No comments:
Post a Comment