Written by Arturo Guadalupi + Copyright Benoit Blanchon 2014-2019
last revision November 2015
*/
#include <WiFiClientSecure.h>
#include <ArduinoJson.h>
#include <Wire.h>
// uncomment the next line if you have a 128x32 OLED on the I2C pins
//#define USE_OLED
// uncomment the next line to deep sleep between requests
//#define USE_DEEPSLEEP
#if defined(USE_OLED)
// Some boards have TWO I2C ports, how nifty. We should use the second one sometimes
#if defined(ARDUINO_ADAFRUIT_QTPY_ESP32S2) || \
defined(ARDUINO_ADAFRUIT_QTPY_ESP32S3_NOPSRAM) || \
defined(ARDUINO_ADAFRUIT_QTPY_ESP32_PICO)
#define OLED_I2C_PORT &Wire1
#else
#define OLED_I2C_PORT &Wire
#endif
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 display = Adafruit_SSD1306(128, 32, OLED_I2C_PORT);
#endif
// Enter your WiFi SSID and password
char ssid[] = "YOUR_SSID";
char pass[] = "YOUR_SSID_PASSWORD";
use as key for WEP)
int keyIndex = 0;
only for WEP)
int status = WL_IDLE_STATUS;
// if you don't want to use DNS (and reduce your sketch size)
// use the numeric IP instead of the name for the server:
//IPAddress server(74,125,232,128);
#define SERVER "cdn.syndication.twimg.com"
#define PATH
"/widgets/followbutton/info.json?screen_names=adafruit"
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(115200);
// Connect to WPA/WPA2 network
WiFi.begin(ssid, pass);
#if defined(USE_OLED)
setupI2C();
delay(200); // wait for OLED to reset
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3C for 128x32
Serial.println(F("SSD1306 allocation failed"));
for(;;); // Don't proceed, loop forever
}
display.display();
display.setTextSize(1);
display.setTextColor(WHITE);
display.clearDisplay();
display.setCursor(0,0);
#else
// Don't wait for serial if we have an OLED
while (!Serial) {
©Adafruit Industries
// your network SSID (name)
// your network password (use for WPA, or
// your network key Index number (needed
// numeric IP for Google (no DNS)
Page 219 of 263
Need help?
Do you have a question about the ESP32-S3 and is the answer not in the manual?