There's Many A Slip - Twixt The Cup And The Lip - aka - Prototyping Problems
Figured out how to connect several of the Sensors and Reactors to the Arduino and found "sketches" (programs) that. with minor changes, worked with them - individually. And I could get a couple of them to work together as I wanted them to work - Sensor "sees" a change in light - and causes an LED (Light Emitting Diode) to glow, flash, flicker randomly or just light up -or a buzzer to buzz.
This is going to be easier than I'd thought it'd be!
WRONG!
Getting one component hooked up and its software working as expected was no big deal. Getting TWO hooked up - and working together as I wanted them to? Well that wasn't too bad either. I could get a "light sensor" to detect when a shadow passed over it - and then cause an LED to flicker like a candle flame. And I could, with some minor modifications to the software, get the light sensor to trigger a speaker which would buzz when a shadow passed over the sensor. So getting a SENSOR and a REACTOR to work together was done. Adding a third component - one that would ATTRACT you to the piece where you could then interact with it? Well THAT wa a problem.
Here's what I WANTED to do.
What looks like a static turned piece sits on a display stand - like static turnings do. BUT - something about it catches your eye. The top of the finial seems to be glowing blue - and the blue light fades on and off. You approach it - and as your shadow passes over what looks like a surface decoration - the piece begins to generate a pulsing sound. You wave your hand over the piece - and the pulsing sound's pitch changes - more shadow - lower tone. Less shadow - higher tones. And you then notice that the little "surface decoration" seems to be controlling the sound. You wave your hand back and forth over it and generate a series of tones from the piece. You wiggle your fingers over it and begin playing more controlled tones. An odd musical instrument - disguised as a wood turning!
The problem I had when dealing with THREE components - one of which was to generate tones - was timing. Tones are generated by turning the speaker On and Off at specific rates - specific frequency - on/off cycles per second. Any of the computer's time spent turning an LED on and off while the speaker was also generating sounds would cause the pitch of the sound to change. It was the Can't Walk AND Chew Gum thing. The solution - Walk OR Chew Gum - have the flickering light function stop - when a shadow falls on the LDR - and have the LDR control the sound generated by the speaker. No shadow - speaker disengaged - and the flickering light routine goes back to flickering the LED - to attract the Next Victim.
Here's the actual First Piece - a finialed hollow form - one of a three piece set titled The Three Sisters. The top of the finial flickers blue - the LDR detector senses a shadow passing over it and the small speaker inside the piece puts out audible tones, their pitch determined by how much or how little light is falling on the detector. Tweeking a few "parameters" for what is sent to the speaker lets you change the sound from slow beeping tones to howling cat noises! A bit more tweeking and it could play the first few notes of God Bless America or Mary Had A Little Lamb. And if you "feed" the speaker a Sound File - a speaking voice could be added! Imagine the piece saying DON'T DO THAT! if you get to close.