Tweeting

I’m having trouble sending my first tweet. I’ve tried the following code from tronixstuff.com (as
well as two similar examples from other sources)

#if defined (ARDUINO) && ARDUINO > 18
#include <SPI.h>
#endif
#include <Ethernet.h>
#include <EthernetDNS.h>
#include <Twitter.h>

byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip = { my arduino’s ip };
byte gateway = { my gateway };
byte subnet = { my subnet };
Twitter twitter(“mytoken”);

void setup()
{
delay(500);
Ethernet.begin(mac, ip, gateway, subnet);
Serial.begin(9600);
}

void tweet(char msg)
{
Serial.println(“connecting…”);
if (twitter.post(msg))
{
int status = twitter.wait(&Serial);
if (status == 200)
{
Serial.println(“OK”);
}

else
{
Serial.print("failed : code ");
Serial.println(status);
}
}
else
{
Serial.println(“connection failed.”);
}
}

void loop()
{
delay(1000);
tweet(“Hello world!”);
do{} while(1>0);
}

Each time I have
the same problem: the serial monitor says

connecting…
connection failed

disconnecting.

I have successfully established an ethernet connection, but cannot
seem to get my arduino to tweet. Any thoughts?

One thing I noticed: although I have downloaded the EthernetDNS
library and put it in my libraries folder, the text “EthernetDNS” is
shown in black (has not turned orange) in my sketch. However, I
attempted to tweet using an example whose author said he managed to
wteet with which did not make use of EthernetDNS, and I got the same
error message.

I don't think EthernetDNS is the problem. You can try to solve the address by your self and to put the ip number directly in your code. I obtain your same error messagge and also in may case I am used to use ethernet shield in may applications without having troubles...

ok, setting the ip address manually for me it works. You can try with this code in twitter.cpp

#define LIB_DOMAIN "arduino-tweet.appspot.com"
static uint8_t server[] = {173,194,65,141}; // IP address of LIB_DOMAIN

Twitter::Twitter(const char *token) : client(server, 80), token(token)
{
}


bool Twitter::post(const char *msg)
{
//	DNSError err = EthernetDNS.resolveHostName(LIB_DOMAIN, server);
//	if (err != DNSSuccess) {
//       Serial.println("il dns è fallito miseramente cazzarola!");
//		return false;
//	}
	parseStatus = 0;
	statusCode = 0;
	if (client.connect()) {

        ecc...