The new Arduino IDE 1.0 or greater will automatically assign an IP address using DHCP. However if you want a static IP, configure the network information in the code, find this section of code and replace the ip, gateway, and subnet values with your own values (see the comment in line 71 of the code).
- byte ip[ ] = { 192, 168, 2, 7 }; // a free IP address on your network
- byte gateway[ ] = { 192, 168, 2, 1 }; // the gateway address of your network
- byte subnet[ ] = { 255, 255, 255, 0 }; // the subnet mask of your network
To get these settings, start by looking at your computer’s network settings. On a Mac, go to System Preferences/Network, then click the Advanced button and select the TCP/IP tab. On a PC, go to Start/Control Panel/Network and Sharing Center, then click View Status and Details. For the code’s free IP address, you can usually just take your network setting and increase the last number a little bit. In my case, my computer’s address is 192.168.2.6, so I tried 192.168.2.12 and it worked fine.
Next is the gateway address. On a Mac, this is listed as Router and on a PC, it’s listed as Default Gateway. Mine is 192.168.2.1. The subnet mask is generally 255.255.255.0, but yours may be different, and it will also be listed in with your computer’s network config information.
Save the revised code, then upload it to your Arduino. With the Arduino environment already configured to recognize your port and board, this usually means just plugging it into your computer and clicking the Upload button. But if you’re not sure how to do this, the Arduino website has great tutorials, and the Resources section on the next page lists other ways to get started.
If you have trouble with any of the software setup, try posting in the MAKE forums. They’re filled with friendly and helpful people.