Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Post a simple message to Twitter */
- #if defined(ARDUINO) && ARDUINO > 18
- #include <SPI.h>
- #endif
- #include <Ethernet.h>
- //#include <EthernetDNS.h> // only for IDE 0022 or earlier
- #include <Twitter.h>
- byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
- byte ip[] = { 192,168,1, 177 };
- byte gateway[] = { 36,72,80,1 };
- byte subnet[] = { 255, 255, 0, 0 };
- Twitter twitter("382956349-7b6otEoMTliErWGrbI2pxsiBX9Cz9RVrIOrfzuV1");
- char msg[] = "Hello test tweet";
- void setup()
- {
- Ethernet.begin(mac, ip, gateway, subnet);
- Serial.begin(9600);
- delay(1000);
- 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()
- {
- }
Advertisement
Add Comment
Please, Sign In to add comment