CODE :-
int val;
int ldrpin=A0;
int maxval=800;
int buzzerpin=6;
void setup() {
// put your setup code here, to run once:
pinMode(ldrpin,INPUT);
pinMode(buzzerpin,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
val=analogRead(ldrpin);
digitalWrite(buzzerpin,LOW);
if (val>maxval) {
digitalWrite(buzzerpin,HIGH);
}
delay(100);
}
0 Comments