My wife and I are making a robot Halloween costume and I just finished the electronics design prototype. I wanted to wait until the costume was finished before revealing it but I’m too excited that I finished my circuit and coding.That’s a video of it, and I want to describe it a little. It uses an Adafruit Wave Shield for the sounds, and an antique analog gauge I found at Gateway Electronics here in St. Louis. There’s an infrared beam pair from Sparkfun, which will be watching the “candy input slot” on the robot’s chest. The gauge displays the count, until too much candy is inserted and it goes crazy. Then after 20 seconds of no more candy, the candy count gets reset, to be ready to do it all over again at the next house. In the sketch, I used these AlphaBeta libraries: LED, button, TimedAction, and Scheduler. These made coding this sketch very easy. He even updated Scheduler with a clear() for me. Thanks again for that! The hardest part was getting it all to work together. I had been trying to use pin 9 for the gauge, and it crashed the sketch. I did more reading and found out you can’t do PWM on 9 with the Wave libraries because of the timer. Pin 6 works fine though. The beep sound loop I found on my mac, I think it came from iMovie. The speech is recorded synthesis also from my mac, made like this from a terminal:
say -o outputfile.aiff "thing to say"