Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void setup ()
- {
- pinMode (A0, INPUT);
- pinMode (7, OUTPUT);
- Serial.begin(9600);
- }
- void loop ()
- {
- int ldrvalue = analogRead(A0);
- Serial.println(ldrvalue);
- if (ldrvalue > 500)
- {
- digitalWrite(7,HIGH);
- tone (3, 399, 350);
- delay (50);
- }
- else
- {
- digitalWrite(7, LOW);
- noTone(3);
- delay(50);
- }
- }
Add Comment
Please, Sign In to add comment