Published on May 15, 2014
Use an analog input to generate a pitch on your speaker. This will produce an effect similar to that of an oscillator.
*To complete this exercise, you will need to download the Arduino software.
In this sketch, the Arduino "reads" the voltage of the analog input (between 0v and 5v), and then assigns a corresponding value from 0 - 1023, where 0v has a value of 0 and 5v has a value of 1023. The pitch of the speaker output will change between depending on the input value. You can experiment by changing the range of the pitch (Hz).
For more “getting started” sketches, click here.
To learn more about coding, find examples on Arduino’s website.