Twitter client that can be directly tweet. (Intermediate server is not required.)

Dependencies:   EthernetInterface HTTPClient-wolfSSL NTPClient OAuth4Tw mbed-rtos mbed wolfSSL

Fork of OAuth4Tw by Atsuya Okazaki

main.cpp

Committer:
geodenx
Date:
2012-05-20
Revision:
0:00a2d3570824
Child:
1:4dfa9d41f414

File content as of revision 0:00a2d3570824:

#include <string.h>
#include "mbed.h"
#include "EthernetNetIf.h"
#include "OAuth4Tw.h"

DigitalOut myled(LED1);
EthernetNetIf eth;

int main() {
    EthernetErr ethErr = eth.setup();
    if (ethErr) {
        printf("Error %d in setup.\n", ethErr);
        return -1;
    }

    OAuth4Tw oa4t("XXXXXXXXXXXXXXXXXXXXXX", // Consumer key
                  "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", // Consumer secret
                  "000000000-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", // Access token
                  "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); // Access token secret
    std::string uri = "http://api.twitter.com/statuses/update.xml";
    uri += "?status=";
    uri += OAuth4Tw::url_escape("Hello World!");
    std::string postarg;
    std::string postres = oa4t.post(uri.c_str(), postarg);
    printf("postres: %s\n", postres.c_str());

    while (1) {
        myled = 1;
        wait(0.2);
        myled = 0;
        wait(0.2);
    }
}