int ldrPin = A0;
int buzz = 10;
void setup() {
// put your setup code here, to run once:
pinMode(ldrPin, INPUT);
pinMode(buzz, OUTPUT);
Serial.begin(9600);
delay(1000);
}
void loop() {
// put your main code here, to run repeatedly:
int temp = analogRead(ldrPin);
Serial.println(temp);
int frequency = map(temp, 0 , 1023, 500 ,2000);
tone(buzz,frequency,2000);
delay(2000);
noTone(buzz);
tone(buzz,frequency,2000);
noTone(buzz);
delay(2000);
}