Hi,
Just new in the world of arduino. I do understand the little things, I got 1 tweet working with a single button, but I wanted to take it up a level. Now it’s dead.
Here’s my code, anyone knows how to fix it?
// Simple twitter interface
#include <SPI.h>
#include <Ethernet.h>
#include <Twitter.h>
#define LOW 0x0
// Alter IP address to suit your own network!
byte mac[] = { 0x12, 0x46, 0x4C, 0x1C, 0x84, 0x3B }; // create MAC address for ethernet shield
byte ip[] = { 192, 168, 0, 99}; // choose your own IP for ethernet shield
Twitter twitter("INSERTMYTOKENHERE"); // replace aaaaaaa with your token
int buttonPin1 = 5;
int buttonPin2 = 6;
int ledred = 13;
void setup()
{
delay(5000);
Ethernet.begin(mac);
Serial.begin(9600);
pinMode(buttonPin1, INPUT);
pinMode(buttonPin2, INPUT);
pinMode(ledred, OUTPUT);
}
void tweet(char msg[])
{
Serial.println("connecting ...");
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 loop(){
if(buttonPin1 == LOW);
delay(1000);
tweet("Goedemorgen!");
}
if(buttonPin2 == LOW;
delay(1000);
tweet("Welterusten!");
}
else{
digitalWrite(ledred, HIGH);
delay(1000);
digitalWrite(ledred, LOW);
}
}
Best regards,
Daan