Step 18: Firmware

Picture of Firmware
This firmware will read incoming twitter data so that if you tweet "feed me!" from the username omnomnom the arduino will light up the two LEDs attached to pins 2 and 3 for 1 second, causing the food delivery sequence to start.

I am using Arduino 1.0 for this project, I recommend downloading this version (or later) for this project.  If you do not want to use the new version, make sure you have the following Arduino libraries (they are bundled with v1.0):
- Ethernet (for the Ethernet Shield)
- EthernetDHCP (for self-configuring the IP address is you use DHCP at home)

Turn on the power switch on the bottom of the feeder, the LCD should flash 12:00 and the motors should run through the food delivery sequence once.  Refer to the manual if you would like to set the clock or set additional food timers, this won't be necessary for the project.  Press the rec button and record a personalized message for your pet, this will play at the end of each food delivery sequence.

Here is the Firmware:

You will need to make a two edits before this firmware is ready to use.

1.  Insert your IP address in the following line at the top of the firmware:
IPAddress ip(190,298,34,132); //<< ENTER YOUR IP ADDRESS HERE!!!
if you don't know your IP address open File>>Examples>>Ethernet>>DhcpAddressPrinter, upload this code to your arduino with the ethernet shield plugged in (and ethernet cable connected), and open the serial monitor Tools>>SerialMonitor

2. Change the username of your twitter account in the following line (from the function connectToServer():
client.println("GET /1/statuses/user_timeline.xml?screen_name=nomnomnomfeeder&count=1 HTTP/1.1");

Upload firmware on your arduino board, plug in the ethernet modem/router.  Tweet "feed me!" from your twitter account and you should see your pet feeder dispense food in a minute or less.  The feeder will not receive any further tweets for four hours (to prevent over feeding), during this time, tweet another message to replace "feed me!" as your most recent message.