December 29, 2010

by Steven



I'm 17 and received a NerdKit for Christmas (thanks, dad!) and quickly picked up the different style of programming and thought processes required. I remembered reading about someone using an Arduino to make a doorbell that sent a tweet when rung. I thought, can I do this with my NerdKit? Of course! (Click to see the TwitPic page) I used code examples from the Morse Code Decoder project and the Crystal Real Time Clock tutorial to read the state of the pushbutton and disable the button for a certain amount of time, and the Buttons, Switches, and Pull-up Resistors section of the Digital Calipers DRO tutorial to wire the pushbutton. Basically, the NerdKit waits until the pushbutton is pressed, sends a "Button pushed." message over the serial port, then enables interrupts and starts the clock, which essentially disables the pushbutton for a set period of time. I didn't want someone to "abuse" the button and send mass amounts of tweets and photos; this would freeze up my computer and internet connection. For testing purposes I set this to 5 seconds, but in a realistic environment you would set it higher, like a few minutes. I wrote a quick program that monitors the serial port for that "Button pressed." message, and when it finds one it will take a photo from the selected webcam, upload it to TwitPic, then tweet "Doorbell rung!" along with the time and the link to the TwitPic photo to my Twitter channel. I made a quick video you can watch on YouTube: http://www.youtube.com/watch?v=dVPgxYO7jEg And here is the link to the Twitter account I made to test it: http://twitter.com/apitestground