Hi
I've just bought an Uno with my pocket money and I'm trying to wire up my door to post messages to twitter. I can't seem to get around the duplicate twitter status block. I would love to tweet "door open :" datetime. So basically just append the date and time to the status door open, but I don't know how and don't know how to append a datetime to a char... sorry not experienced enough yet
My code (taken from instructables) is below and I was hoping someone with more experience could help me out...
/* Example 30.2 - tweeting digital event status
Use the ethernet shield and your Arduino board to send tweets
Big thanks to @neocat and Georg Kaindl Arduino Tutorials | tronixstuff.com > chapter thirty */
// necessary libraries#if defined(ARDUINO) && ARDUINO > 18
// If using Arduino 0019 or later, include SPI.h
#if defined(ARDUINO) && ARDUINO > 18
#include <SPI.h>
#endif
#include <Ethernet.h>
#include <Twitter.h>
char b1[]="Door Open";
byte mac[] = { 0x92,0xA5,0xDA,0x00,0x7E,0x48 };
byte ip[] = { 192,168,1,8 };
Twitter twitter("#####################");
void setup()
{
delay(5000);
Ethernet.begin(mac);
Serial.begin(9600);
pinMode(2, INPUT);
}
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()
{
if (digitalRead(2)==HIGH)
{ tweet(b1); delay(2000); }
}