We've worked with light - simulating a flickering candle and distributing internal light to points on the outside surface of a piece - and change the light's color. Now let's add SOUND.
Here's the illustrated piece. There's a sensor to detect shadows (Light Detecting Resistor or LDR), an LED that'll shine light out the top of the finial - and - a speaker, it's sound controlled by how much or how littlelight is falling on the sensor.
Here's the FRITZ wiring diagram for this example. It's basically the same as the last example - but with a small speaker added.
The "sketch" for this set up has to deal with a problem introduced by adding the speaker. The sound it will make will be done by turning the speaker on and off a number of times per second - actually several thousand times per second. The higher the cycles per second, the higher the pitch of the resulting audible sound. The lower the cycles per second, the lower the pitch of the resulting audible sounds.cuses a special feature - elapsed time from the last micro controller's reset.