Try this out there is no debounce of the pin Interrupt 0 is digital pin 2 on the Uno baord
#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>
//const int ledPin = 3;
int ledState = LOW;
// 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, 2, 250 };
// Your Token to Tweet (get it from http://arduino-tweet.appspot.com/)
Twitter twitter("1220261654-BPUYlMFTyfs5ooSFSA62C57Ujeqnr9hdn7PARZm");
// you shouldn't post your token we could post on your Twitter account with this info...
// Message to post
void setup()
{
digitalWrite(2, HIGH); //turn on internall pullup resistor
attachInterrupt(0, ExtInt0Fall, FALLING); // there is no debouce of this pin
delay(1000);
Ethernet.begin(mac);
// or you can use DHCP for autoomatic IP address configuration.
// Ethernet.begin(mac);
Serial.begin(9600);
Serial.println("connecting ...");
char msg[]="que odes";
}
void loop()
{
if (ledState == HIGH)
{
ledState = LOW;
int cont=0; // ? what is this for??
Serial.println("High now");
delay(1000);
if (twitter.post(msg))
{
// 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)
{
Serial.println("OK.");
}
else
{
Serial.print("failed : code ");
Serial.println(status);
}
}
else
Serial.println("connection failed.");
}
}
void ExtInt0Fall()
{
ledState = HIGH;
}