EasyManuals Logo

Adafruit ESP32-S3 User Manual

Adafruit ESP32-S3
263 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #221 background imageLoading...
Page #221 background image
// Allocate the JSON document
// Use arduinojson.org/v6/assistant to compute the capacity.
const size_t capacity = JSON_ARRAY_SIZE(1) + JSON_OBJECT_SIZE(8) + 200;
DynamicJsonDocument doc(capacity);
// Parse JSON object
DeserializationError error = deserializeJson(doc, client);
if (error) {
Serial.print(F("deserializeJson() failed: "));
Serial.println(error.c_str());
return;
}
// Extract values
JsonObject root_0 = doc[0];
Serial.println(F("Response:"));
const char* root_0_screen_name = root_0["screen_name"];
long root_0_followers_count = root_0["followers_count"];
Serial.print("Twitter username: "); Serial.println(root_0_screen_name);
Serial.print("Twitter followers: "); Serial.println(root_0_followers_count);
#if defined(USE_OLED)
display.clearDisplay(); display.setCursor(0,0);
display.setTextSize(2);
display.println(root_0_screen_name);
display.println(root_0_followers_count);
display.display();
display.setTextSize(1);
#endif
// Disconnect
client.stop();
delay(1000);
#if defined(USE_DEEPSLEEP)
#if defined(USE_OLED)
display.clearDisplay();
display.display();
#endif // OLED
#if defined(NEOPIXEL_POWER)
digitalWrite(NEOPIXEL_POWER, LOW); // off
#elif defined(NEOPIXEL_I2C_POWER)
digitalWrite(NEOPIXEL_I2C_POWER, LOW); // off
#endif
// wake up 1 second later and then go into deep sleep
esp_sleep_enable_timer_wakeup(10 * 1000UL * 1000UL); // 10 sec
esp_deep_sleep_start();
#else
delay(10 * 1000);
#endif
}
void setupI2C() {
#if defined(ARDUINO_ADAFRUIT_QTPY_ESP32S2) || \
defined(ARDUINO_ADAFRUIT_QTPY_ESP32S3_NOPSRAM) || \
defined(ARDUINO_ADAFRUIT_QTPY_ESP32_PICO)
// ESP32 is kinda odd in that secondary ports must be manually
// assigned their pins with setPins()!
Wire1.setPins(SDA1, SCL1);
#endif
#if defined(NEOPIXEL_I2C_POWER)
pinMode(NEOPIXEL_I2C_POWER, OUTPUT);
digitalWrite(NEOPIXEL_I2C_POWER, HIGH); // on
#endif
#if defined(ARDUINO_ADAFRUIT_FEATHER_ESP32S2)
// turn on the I2C power by setting pin to opposite of 'rest state'
©Adafruit Industries Page 221 of 263

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Adafruit ESP32-S3 and is the answer not in the manual?

Adafruit ESP32-S3 Specifications

General IconGeneral
BrandAdafruit
ModelESP32-S3
CategoryMicrocontrollers
LanguageEnglish

Related product manuals