All you really need to do is something like this.
#include <SPI.h>
#include <SC16IS750.h>
#include <WiFly.h>
#include "Credentials.h"
char token[] = "YOUR TOKEN HERE"; //@normbot
char msg[140];
char url[] = "arduino-tweet.appspot.com";
int hour = 3600000;
WiFlyClient client( url, 80 );
void setup() {
Serial.begin(9600);
SC16IS750.begin();
WiFly.setUart(&SC16IS750);
WiFly.begin();
if (WiFly.join(ssid, passphrase)) {
Serial.print("Associated with ");
Serial.println(ssid);
}
else {
Serial.println("Association failed.");
while (1) {
// Hang on failure.
}
}
}
void loop() {
Serial.print("connecting to ");
Serial.println( url);
String starDate( millis());
String startOfMsg("Normbot Log: Stardate " + starDate);
String fullMsg( startOfMsg + ". Still no sign of WD40" );
for ( int i = 0; i < sizeof( msg ); i++ ) {
msg[i] = '\0';
}
fullMsg.toCharArray( msg, fullMsg.length() + 1 );
if (client.connect()) {
Serial.println("connected");
client.println("POST http://arduino-tweet.appspot.com/update HTTP/1.0");
client.print("Content-Length: ");
client.println(strlen(msg)+strlen(token)+14);
client.println();
client.print("token=");
client.print(token);
client.print("&status=");
client.println(msg);
}
else {
Serial.println("connection failed");
}
if ( client.available()) {
char c = client.read();
Serial.print(c);
}
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
}
delay(600000);
}
It's not perfect - I cobbled the code together as a proof of concept. I will work on porting the Twitter library to WiFly when I get more time. The code above works though.