Photoresistor and speaker circuit with Arduino

From Knowledge Kitchen
Jump to navigation Jump to search


This example shows how to read a photoresistor using the Arduino, and use its value to change the frequency of sound coming out of a speaker.

Open the Serial Monitor window in the Arduino software to view the debugging messages output by the program.


The circuit

Photoresistor and speaker circuit with Arduino


The code

Photoresistor and speaker with Arduino code


Questions

  1. How would you change the circuit (without altering the code), so that the behavior of the sound in relation to the light falling on the photoresistor was reversed?


What links here