-
Notifications
You must be signed in to change notification settings - Fork 5
/
tweet.cpp
33 lines (29 loc) · 812 Bytes
/
tweet.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Message to post
char msg[] = "Hi, I'm tweeting from a freaking arduino right now!";
#include <string.h>
#define LIB_DOMAIN "arduino-tweet.appspot.com"
#define TOKEN "**PLACE TOKEN HERE**"
TCPClient client;
// EXAMPLE USAGE
void setup()
{
delay(1000);
// or you can use DHCP for autoomatic IP address configuration.
// Ethernet.begin(mac);
Serial.begin(9600);
Serial.println("connecting .test..");
client.connect(LIB_DOMAIN, 80);
client.println("POST /update HTTP/1.0");
client.println("Host: " LIB_DOMAIN);
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);
}
void loop()
{
Serial.println("connecting .test");
}