EasyManua.ls Logo

Adafruit ESP32-S3 - Defined(Arduino_Adafruit_Qtpy_Esp32 S3_Nopsram); If Defined(ARDUINO_ADAFRUIT_QTPY_ESP32 S2)

Adafruit ESP32-S3
263 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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"; // your network SSID (name)
char pass[] = "YOUR_SSID_PASSWORD"; // your network password (use for WPA, or
use as key for WEP)
int keyIndex = 0; // your network key Index number (needed
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); // numeric IP for Google (no DNS)
#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 Page 219 of 263

Table of Contents

Related product manuals