Skip to content
Twitter client library for Arduino
Branch: master
Clone or download
NeoCat Merge pull request #2 from JChristensen/dev
Add "Connection" header to close connection.
Latest commit 7fd7730 Feb 14, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples initial commit Aug 20, 2016
LICENSE.txt initial commit Aug 20, 2016 initial commit Aug 20, 2016
Twitter.cpp Add "Connection" header to close connection. Feb 14, 2019
keywords.txt initial commit Aug 20, 2016 initial commit Aug 20, 2016

Twitter client library for Arduino

A library to post tweets to Twitter from Arduino with an Ethernet Shield. This library uses relay server on GooleAppEngine to handle OAuth authentication:


Some sample sketches for Arduino included(/examples/).

  • SimplePost : Send a tweet once Arduino is reset. (Note that duplicated tweets will be rejected by Twitter.)
  • Twitter_Serial_GW : Send tweets based on the input from the Serial.

How to use

  • Add this library to your Arduino IDE.

  • Get a token to post a message using OAuth from the relay server: -> "Step 1."

    When you allow the access, your token is issued.

  • Pass your token to the constructor of Twitter class, like:

     Twitter twitter("YOUR-TOKEN");



You need to create an instance of Twitter class like below:

Twitter twitter("YOUR-TOKEN");

You need also begin Ethernet library.


bool post(const char *message)

Begin posting the specified message to Twitter. If connection to is established successfully, this function returns true.

If failed to connect Twitter, returns false. (Check Ethernet is correctly configured.)

Posting is not done yet even it returns true. You should call twitter.checkStatus() periodically or twitter.wait().

bool checkStatus(Print *debug = NULL)

Check if the posting request is running. Returns true if it's still running.

You can specify the debug argument to output the response from server for debugging, e.g.


int status(void)

Returns the HTTP status code in response from Twitter, e.g. 200 - OK.

Only available after posting the message is done and checkStatus() returns false.

int wait(Print *debug = NULL)

Wait until posting the message is done. Return value of this function is HTTP status code in response from Twitter.

Equivalent to the code below:

while (checkStatus(debug));
    return statusCode;
You can’t perform that action at this time.