It is compatible with the methods normally related to plain
connections, like client.connect(host, port).
Written by Arturo Guadalupi
last revision November 2015
*/
#include <WiFiClientSecure.h>
// 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"
// Initialize the SSL client library
// with the IP address and port of the server
// that you want to connect to (port 443 is default for HTTPS):
WiFiClientSecure client;
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// attempt to connect to Wifi network:
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("Connected to WiFi");
printWifiStatus();
client.setInsecure(); // don't use a root cert
Serial.println("\nStarting connection to server...");
// if you get a connection, report back via serial:
if (client.connect(SERVER, 443)) {
Serial.println("connected to server");
// Make a HTTP request:
client.println("GET " PATH " HTTP/1.1");
client.println("Host: " SERVER);
client.println("Connection: close");
client.println();
}
}
uint32_t bytes = 0;
void loop() {
©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 216 of 263
Need help?
Do you have a question about the ESP32-S3 and is the answer not in the manual?