latinet:unicaes:workshops:communication-23
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| latinet:unicaes:workshops:communication-23 [2024/09/10 20:30] – [2. ESP8266 and WiFi] harley.lara | latinet:unicaes:workshops:communication-23 [2024/09/10 20:39] (current) – harley.lara | ||
|---|---|---|---|
| Line 29: | Line 29: | ||
| // Create an instance of WiFiClientSecure | // Create an instance of WiFiClientSecure | ||
| - | WiFiClientSecure | + | WiFiClientSecure |
| void setup() { | void setup() { | ||
| Line 48: | Line 48: | ||
| // Set the client to verify the server' | // Set the client to verify the server' | ||
| - | | + | |
| // Give the client a chance to perform the handshake | // Give the client a chance to perform the handshake | ||
| Line 57: | Line 57: | ||
| if (WiFi.status() == WL_CONNECTED) { | if (WiFi.status() == WL_CONNECTED) { | ||
| - | | + | |
| // Make an HTTPS GET request | // Make an HTTPS GET request | ||
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| // Wait for the response | // Wait for the response | ||
| - | while (client.connected()) { | + | while (wifi_client.connected()) { |
| - | if (client.available()) { | + | if (wifi_client.available()) { |
| // read an incoming byte from the server and print it to serial monitor: | // read an incoming byte from the server and print it to serial monitor: | ||
| - | char c = client.read(); | + | char c = wifi_client.read(); |
| Serial.print(c); | Serial.print(c); | ||
| } | } | ||
| } | } | ||
| - | | + | |
| } | } | ||
| Line 82: | Line 82: | ||
| ===== 3. Our first MQTT Publish ===== | ===== 3. Our first MQTT Publish ===== | ||
| + | |||
| Stepping ahead, you'll have the chance to implement your first MQTT publish from the ESP8266. While the following example provides a static demonstration, | Stepping ahead, you'll have the chance to implement your first MQTT publish from the ESP8266. While the following example provides a static demonstration, | ||
| - | PubSubClient | + | To start, search and install the library "PubSubClient |
| <file c++ mqtt-publish.ino> | <file c++ mqtt-publish.ino> | ||
latinet/unicaes/workshops/communication-23.1725993043.txt.gz · Last modified: 2024/09/10 20:30 by harley.lara