These devices have a small led that flashes and a beep when you whistle. I had one left over knocking about the house, so I wanted to find a use for it. They are about 3 x 3 x 1.5 cm and run off a couple of button cells. You don't need to use the plastic whistle to work it, you can use purse your lips and do it yourself - needs to be loud though.http://www.amazon.com/Whistle-Locator-Stereo-Remote-Control/dp/B000ODQ7EQ
I hooked one up to flash onto an LDR so when you whistle a signal goes via analogue pin to start a servo and wag a piece of wire. Easy way to add an interactive
wagging tail to your robot! The LED is placed right next to the LDR and the whole lot is shaded from ambient light.
int wag = 0;
int lightPin = 0;
int servopin = 7; //the pin the servo is connected to
pinMode(servopin, OUTPUT); //sets the servo pin to output
digitalWrite(servopin, LOW); //servo OFF
int lightLevel = analogRead(lightPin); //Read the
if (lightLevel > 450)
wag = 1;
if (wag == 1)
for (pos = 0; pos < 180 ; pos +=2)
I put in serial for debugging. You need to play around with what light level you need to trigger the wagging. Also your LDR may vary from mine. See video.
Would welcome some feedback for improvements, additional actions etc..