esp32 tests

This commit is contained in:
Liz 2024-06-24 17:05:53 -04:00
parent 768256cfe0
commit 690f3a01cf
4 changed files with 4 additions and 9 deletions

View file

@ -16,6 +16,7 @@ last revision November 2015
*/ */
#include <WiFi.h>
#include <WiFiClientSecure.h> #include <WiFiClientSecure.h>
#include <ArduinoJson.h> #include <ArduinoJson.h>
#include <Wire.h> #include <Wire.h>
@ -44,16 +45,9 @@ 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) 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 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 SERVER "cdn.syndication.twimg.com"
#define PATH "/widgets/followbutton/info.json?screen_names=adafruit" #define PATH "/widgets/followbutton/info.json?screen_names=adafruit"
void setup() { void setup() {
//Initialize serial and wait for port to open: //Initialize serial and wait for port to open:
Serial.begin(115200); Serial.begin(115200);
@ -90,7 +84,6 @@ void setup() {
display.display(); display.display();
#endif #endif
while (WiFi.status() != WL_CONNECTED) { while (WiFi.status() != WL_CONNECTED) {
delay(500); delay(500);
Serial.print("."); Serial.print(".");

View file

@ -16,6 +16,7 @@ last revision November 2015
*/ */
#include <WiFiClientSecure.h> #include <WiFiClientSecure.h>
#include <WiFi.h>
// Enter your WiFi SSID and password // Enter your WiFi SSID and password
char ssid[] = "YOUR_SSID"; // your network SSID (name) char ssid[] = "YOUR_SSID"; // your network SSID (name)

View file

@ -21,6 +21,7 @@
#include <Adafruit_GFX.h> // Core graphics library #include <Adafruit_GFX.h> // Core graphics library
#include <HTTPClient.h> #include <HTTPClient.h>
#include <WiFi.h>
#include <ArduinoJson.h> //https://github.com/bblanchon/ArduinoJson #include <ArduinoJson.h> //https://github.com/bblanchon/ArduinoJson
#include <Adafruit_EPD.h> #include <Adafruit_EPD.h>
#include "secrets.h" #include "secrets.h"
@ -212,7 +213,7 @@ String getURLResponse(String url)
void getQuote(String &quote, String &author) void getQuote(String &quote, String &author)
{ {
StaticJsonDocument<1024> doc; DynamicJsonDocument doc(1024);
String url = "https://www.adafruit.com/api/quotes.php"; String url = "https://www.adafruit.com/api/quotes.php";
String jsonquote = getURLResponse(url); String jsonquote = getURLResponse(url);
if(jsonquote.length() > 0) if(jsonquote.length() > 0)