Hi!
I wired a breadboard along the lines of the pitch follower lesson (http://arduino.cc/en/Tutorial/Tone2).
I get a reading from the LDR, map it along the output range into the pitch variable, and...... nothing happens.
What did I miss?
@KE7GKP:
Thanks for the quick replay!
As for your inquiries:
1)Speaker is good.
2)Just tested it, and it works as it should, along with the tone() command.
3) right now, approximately between 100 to 300.
4) this range is mapped 10 to 1000
I commented out the Serial.println(sensorReading); and then added Serial.println(thisPitch); at the end of the loop.
I uploaded the sketch and was greeted by a continuous shriek from the speaker, varied by the amount of light the LDR was radiated by.
I reversed the changes in the sketch, and same result.
In other words, it's fixed, without any real change to the sketch or circuit.
Too bad I didn't read the mapped output from the time it didn't work.
Any idea what happened?
Or maybe on how to reproduce?
Removing any trace of serial (from the include command down to serial.println) has no apparent effect.
I went through all the wiring several times and it was impeccable, but putting my ego aside(), that's the most plausible reason for my problem.
Thanks for your help. I really appreciate it.