Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TwitterWebAPI

An Arduino library to talk to Twitter using [Twitter Web API](https://dev.twitter.com/overview/api) made for ESP8266. This is based on a sketch posted [here](https://github.com/soramimi/ESP8266Tweet). There are other approaches like using a bearer token [arduino-twitter-api](https://github.com/witnessmenow/arduino-twitter-api), but there are limitations in terms of not being able to send tweet. This can both search/read and post tweets.
An Arduino library to talk to Twitter using [Twitter Web API](https://dev.twitter.com/overview/api) made for ESP8266/ESP32. This is based on a sketch posted [here](https://github.com/soramimi/ESP8266Tweet). There are other approaches like using a bearer token [arduino-twitter-api](https://github.com/witnessmenow/arduino-twitter-api), but there are limitations in terms of not being able to send tweet. This can both search/read and post tweets.

[![ESP8266 TwitterWebAPI](https://img.youtube.com/vi/ZDGhFYGj5tc/0.jpg)](https://www.youtube.com/watch?v=ZDGhFYGj5tc)

Expand All @@ -16,13 +16,11 @@ Fill the obtained Consumer Key, Consumer Secret, Access Token and Access Token S
## Using the Library
* Download this GitHub [library](https://github.com/debsahu/TwitterWebAPI/archive/master.zip).
* In Arduino, Goto Sketch -> Include Library -> Add .ZIP Library... and point to the zip file downloaded.
* Install [TimeLib library](https://github.com/PaulStoffregen/Time) and [NTPClient library](https://github.com/arduino-libraries/NTPClient) using the same procedure.
* Install Optional [Arduino JSON](https://github.com/bblanchon/ArduinoJson)

To use in your sketch include these lines.
```
#include <TwitterWebAPI.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
```
Define Twitter GET request timeout (optional, default is 1500ms)
```
Expand All @@ -44,13 +42,12 @@ You **WILL** need **Consumer Key, Consumer Secret, Access Token and Access Token
```
Declare clients before setup().
```
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, ntp_server, timezone*3600, 60000); // NTP server pool, offset (in seconds), update interval (in milliseconds)
TwitterClient tcr(timeClient, consumer_key, consumer_sec, accesstoken, accesstoken_sec);
WiFiClientSecure sclient;
TwitterClient tcr(sclient, consumer_key, consumer_sec, accesstoken, accesstoken_sec);
```
In setup make sure to start NTP connection. A correct time is required to be able to post/search on Twitter.
```
tcr.startNTP();
tcr.startNTP(ntp_server, timezone);
```
**Search for a key word**
```
Expand All @@ -68,11 +65,11 @@ std::string twitter_post_msg;
tcr.tweet(twitter_post_msg);
```
## Example: TwitterTweetSearchFSWiFiMgr
In addition to [TwitterWebAPI](https://github.com/debsahu/TwitterWebAPI), make sure that [TimeLib library](https://github.com/PaulStoffregen/Time) and [NTPClient library](https://github.com/arduino-libraries/NTPClient) is installed, and install the following libraries
In addition to [TwitterWebAPI](https://github.com/debsahu/TwitterWebAPI), ~~make sure that [TimeLib library](https://github.com/PaulStoffregen/Time) and [NTPClient library](https://github.com/arduino-libraries/NTPClient) is installed~~ (No longer needed) , and install the following libraries
* [Arduino JSON](https://github.com/bblanchon/ArduinoJson)
* [WiFiManager](https://github.com/tzapu/WiFiManager)
* [WiFiManager - Development](https://github.com/tzapu/WiFiManager/tree/development)

For display you can either install
* [MAX7219 library](https://github.com/SensorsIot/MAX7219-4-digit-display-for-ESP8266)
or
or
* [MD Parola](https://github.com/MajicDesigns/MD_Parola) & [MD_Max72xx](https://github.com/MajicDesigns/MD_MAX72xx)
Loading