After I finished the first test with the Ethernet shield and serving your own page from Arduino (see post here Arduino - Talking plant, with HTTP server (or how to see sensor data via internet)) I said, ok, but if I don't have my own static IP address!?!? Most of us don't have a static IP address at home. Yeah it was fun with the other one to play in a LAN or use the university network to get an own IP, but at home this device renders useless. I tried with other social networks or email providers but it looks like Facebook, Yahoo mail and Gmail have quite some problems talking with Arduino and Arduino has some problems talking with them, the only one available remained Twitter.


Having as starting point I modified my previous code to this one:

#include <SPI.h> // needed in Arduino 0019 or later
#include <Ethernet.h>
#include <Twitter.h>

// The includion of EthernetDNS is not needed in Arduino IDE 1.0 or later.
// Please uncomment below in Arduino IDE 0022 or earlier.
//#include <EthernetDNS.h>

// Ethernet Shield Settings
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// If you don't specify the IP address, DHCP is used(only in Arduino 1.0 or later).
//byte ip[] = { 192, 168, 9, 122 }; //

// Your Token to Tweet (get it from
Twitter twitter("please put here your token");

// Message to post - just to initialize the variable
char msg[] = "Hello, World! I'm Arduino!";

void setup()
    // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
  Serial.println("connecting ...");
  if ( {
    // Specify &Serial to output received response to Serial.
    // If no output is required, you can just omit the argument, e.g.
    // int status = twitter.wait();
    int status = twitter.wait(&Serial);
    if (status == 200) {
    } else {
      Serial.print("failed : code ");
  } else {
    Serial.println("connection failed.");

int temp = 1;
int oldtemp = 1;
int val;

void loop()
  val = analogRead(0);

  if (val > 40) { temp = 1; }

  if (val <20 ) { temp = 0; }

  if (oldtemp != temp) {
    oldtemp = temp;
    if (temp == 1) {
      sendTwitterUpdate("Im Gewächshaus brennt es!");
    else {
      sendTwitterUpdate("Es ist zu kalt für die Pflanzen!");


 Now you can get more creative and do more out of it.