An automated tweet project by my students uses the Twitter library found at http://arduino-tweet.appspot.com/ for sending tweets when a button is pressed. My question is about the best placement of Ethernet.begin(mac); when the project is in an environment where the Internet connection gets dropped from time to time, which is the case in our school--not a problem in our circuit, but cable problems in the neighborhood. Currently they have it in setup, so the IP is acquired when the program starts. Sometimes when our connection goes down and comes back up and the program has been left running, not restarted, I will notice the Arduino becomes inconsistent in its tweet success rate. It's not a problem with duplicate tweets or too frequent tweets--we've worked out contingencies for that. Would it be better to place Ethernet.begin(mac); inside the button pressed condition to make sure the IP is established? Or would this not make a difference? I don't know how the Ethernet object works, if it is continuously checking the connection. If that's the case I would think keeping it in setup should be fine and something else is causing the inconsistent tweets. Thanks, Erik
Instead of using Ethernet.begin(mac) more than once, I have found Ethernet.maintain() will renew an expired lease. http://arduino.cc/en/Reference/EthernetMaintain
thanks, I'll try that. of course I should have looked at the docs.