By connecting to the internet you can exchange data between your ESP8266 and the network.
Let’s look at how we can load content from a web server using the Hyper Text Transfer
Protocol (HTTP). This protocol is the foundation of the World Wide Web.
1
#include <ESP8266WiFi.h>
2
3
char* ssid = "SSID";
4 const char* password = "PASSW0RD";
5
6 const char* host = "www.squix.org";
7
8
void setup() {
9
Serial.begin(115200);
10
11
Serial.print("Connecting to ");
12 Serial.println(ssid);
13
14
WiFi.begin(ssid, password);
15
16
//
Wait until WiFi is connected
17 while (WiFi.status() != WL_CONNECTED)
{
18 delay(500);
19
Serial.print(".");
20 }
21
22
Serial.println("");
23
Serial.println("WiFi connected");
24
Serial.println("IP address: ");
25
Serial.println(WiFi.localIP());
26 }
27
28 void loop()
{ 29
delay(5000);