EasyManuals Logo

Espressif ESP8266 User Manual

Espressif ESP8266
51 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 #28 background imageLoading...
Page #28 background image
64
String line = client.readStringUntil('\r');
65
Serial.print(line);
66 }
67
68 }
How does this work? First we define the SSID and password of the WiFi access point we want
to connect to. Please note that there are better ways to do that. The WiFiManager
(https://github.com/tzapu/WiFiManager) for instance starts the ESP8266 as an access point if
it cannot connect to any SSID. You then use your smartphone to configure the WiFi credentials
and there is no need to hard code these into your firmware. But for the sake of simplicity let’s
ignore this here.
On line 14 we start connecting to the defined access point and wait until the connection is
established. After all there is no point to send requests to a server if the network connection
is not confirmed yet.
Line 49 sends the request to the server. The command GET /guide/ HTTP/1.1\r\n might look
strange to you. This is how your browser talks to the web server. GET is the command for the
webserver, /guide/ is the resource on the server we want to get and HTTP/1.1 is the protocol
that we are using. If you are interested how this works in detail have a look at this Wikipedia
article: https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol.
On line 63 we print out the response line by line as long as there is text coming in. Sadly this
is quite complicated. Especially if we want to add encryption in the form of SSL to the
connection. This protects your data and makes sure that you are talking to the right server.
With the following command we can verify that the host matches the given SHA1 fingerprint.
1
if (client.verify(fingerprint, host)) {
2
Serial.println("certificate matches");
3
} else {
4
Serial.println("certificate doesn't match");
5
return;
6 }
How can you find this fingerprint? Your browser can help you with this. I will show it with
Chrome. First open the page you need the fingerprint for, in my case www.google.ch. Then
click on the little lock symbol and then on Details:

Other manuals for Espressif ESP8266

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Espressif ESP8266 and is the answer not in the manual?

Espressif ESP8266 Specifications

General IconGeneral
Digital I/O Pins17
Analog Input Pins1
Wi-Fi802.11 b/g/n
Operating Voltage3.0V - 3.6V
Clock Speed80 MHz / 160 MHz
Operating Temperature-40°C to 125°C
Dimensions24mm x 14mm
ProcessorTensilica L106 32-bit micro controller

Related product manuals