Skip to content

Commit 14f67c4

Browse files
committed
Rename ESP8266httpClient to ESP8266HTTPClient (part 1)
1 parent abd98f1 commit 14f67c4

File tree

9 files changed

+1035
-1035
lines changed

9 files changed

+1035
-1035
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,68 @@
1-
/**
2-
* BasicHttpClient.ino
3-
*
4-
* Created on: 24.05.2015
5-
*
6-
*/
7-
8-
#include <Arduino.h>
9-
10-
#include <ESP8266WiFi.h>
11-
#include <ESP8266WiFiMulti.h>
12-
13-
#include <ESP8266httpClient.h>
14-
15-
#define USE_SERIAL Serial
16-
17-
ESP8266WiFiMulti WiFiMulti;
18-
19-
void setup() {
20-
21-
USE_SERIAL.begin(115200);
22-
// USE_SERIAL.setDebugOutput(true);
23-
24-
USE_SERIAL.println();
25-
USE_SERIAL.println();
26-
USE_SERIAL.println();
27-
28-
for(uint8_t t = 4; t > 0; t--) {
29-
USE_SERIAL.printf("[SETUP] WAIT %d...\n", t);
30-
USE_SERIAL.flush();
31-
delay(1000);
32-
}
33-
34-
WiFiMulti.addAP("SSID", "PASSWORD");
35-
36-
}
37-
38-
void loop() {
39-
// wait for WiFi connection
40-
if((WiFiMulti.run() == WL_CONNECTED)) {
41-
42-
httpClient http;
43-
44-
USE_SERIAL.print("[HTTP] begin...\n");
45-
// configure traged server and url
46-
//http.begin("192.168.1.12", 443, "/test.html", true, "7a 9c f4 db 40 d3 62 5a 6e 21 bc 5c cc 66 c8 3e a1 45 59 38"); //HTTPS
47-
http.begin("192.168.1.12", 80, "/test.html"); //HTTP
48-
49-
USE_SERIAL.print("[HTTP] GET...\n");
50-
// start connection and send HTTP header
51-
int httpCode = http.GET();
52-
if(httpCode) {
53-
// HTTP header has been send and Server response header has been handled
54-
USE_SERIAL.printf("[HTTP] GET... code: %d\n", httpCode);
55-
56-
// file found at server
57-
if(httpCode == 200) {
58-
String payload = http.getString();
59-
USE_SERIAL.println(payload);
60-
}
61-
} else {
62-
USE_SERIAL.print("[HTTP] GET... failed, no connection or no HTTP server\n");
63-
}
64-
}
65-
66-
delay(10000);
67-
}
68-
1+
/**
2+
* BasicHTTPClient.ino
3+
*
4+
* Created on: 24.05.2015
5+
*
6+
*/
7+
8+
#include <Arduino.h>
9+
10+
#include <ESP8266WiFi.h>
11+
#include <ESP8266WiFiMulti.h>
12+
13+
#include <ESP8266HTTPClient.h>
14+
15+
#define USE_SERIAL Serial
16+
17+
ESP8266WiFiMulti WiFiMulti;
18+
19+
void setup() {
20+
21+
USE_SERIAL.begin(115200);
22+
// USE_SERIAL.setDebugOutput(true);
23+
24+
USE_SERIAL.println();
25+
USE_SERIAL.println();
26+
USE_SERIAL.println();
27+
28+
for(uint8_t t = 4; t > 0; t--) {
29+
USE_SERIAL.printf("[SETUP] WAIT %d...\n", t);
30+
USE_SERIAL.flush();
31+
delay(1000);
32+
}
33+
34+
WiFiMulti.addAP("SSID", "PASSWORD");
35+
36+
}
37+
38+
void loop() {
39+
// wait for WiFi connection
40+
if((WiFiMulti.run() == WL_CONNECTED)) {
41+
42+
HTTPClient http;
43+
44+
USE_SERIAL.print("[HTTP] begin...\n");
45+
// configure traged server and url
46+
//http.begin("192.168.1.12", 443, "/test.html", true, "7a 9c f4 db 40 d3 62 5a 6e 21 bc 5c cc 66 c8 3e a1 45 59 38"); //HTTPS
47+
http.begin("192.168.1.12", 80, "/test.html"); //HTTP
48+
49+
USE_SERIAL.print("[HTTP] GET...\n");
50+
// start connection and send HTTP header
51+
int httpCode = http.GET();
52+
if(httpCode) {
53+
// HTTP header has been send and Server response header has been handled
54+
USE_SERIAL.printf("[HTTP] GET... code: %d\n", httpCode);
55+
56+
// file found at server
57+
if(httpCode == 200) {
58+
String payload = http.getString();
59+
USE_SERIAL.println(payload);
60+
}
61+
} else {
62+
USE_SERIAL.print("[HTTP] GET... failed, no connection or no HTTP server\n");
63+
}
64+
}
65+
66+
delay(10000);
67+
}
68+
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,65 @@
1-
/**
2-
* reuseConnection.ino
3-
*
4-
* Created on: 22.11.2015
5-
*
6-
*/
7-
8-
9-
#include <Arduino.h>
10-
11-
#include <ESP8266WiFi.h>
12-
#include <ESP8266WiFiMulti.h>
13-
14-
#include <ESP8266httpClient.h>
15-
16-
#define USE_SERIAL Serial
17-
18-
ESP8266WiFiMulti WiFiMulti;
19-
20-
httpClient http;
21-
22-
void setup() {
23-
24-
USE_SERIAL.begin(115200);
25-
// USE_SERIAL.setDebugOutput(true);
26-
27-
USE_SERIAL.println();
28-
USE_SERIAL.println();
29-
USE_SERIAL.println();
30-
31-
for(uint8_t t = 4; t > 0; t--) {
32-
USE_SERIAL.printf("[SETUP] WAIT %d...\n", t);
33-
USE_SERIAL.flush();
34-
delay(1000);
35-
}
36-
37-
WiFiMulti.addAP("SSID", "PASSWORD");
38-
39-
40-
}
41-
42-
void loop() {
43-
// wait for WiFi connection
44-
if((WiFiMulti.run() == WL_CONNECTED)) {
45-
46-
http.begin("192.168.1.12", 80, "/test.html");
47-
48-
int httpCode = http.GET();
49-
if(httpCode) {
50-
USE_SERIAL.printf("[HTTP] GET... code: %d\n", httpCode);
51-
52-
// file found at server
53-
if(httpCode == 200) {
54-
http.writeToStream(&USE_SERIAL);
55-
}
56-
} else {
57-
USE_SERIAL.print("[HTTP] GET... failed, no connection or no HTTP server\n");
58-
}
59-
}
60-
61-
delay(1000);
62-
}
63-
64-
65-
1+
/**
2+
* reuseConnection.ino
3+
*
4+
* Created on: 22.11.2015
5+
*
6+
*/
7+
8+
9+
#include <Arduino.h>
10+
11+
#include <ESP8266WiFi.h>
12+
#include <ESP8266WiFiMulti.h>
13+
14+
#include <ESP8266HTTPClient.h>
15+
16+
#define USE_SERIAL Serial
17+
18+
ESP8266WiFiMulti WiFiMulti;
19+
20+
HTTPClient http;
21+
22+
void setup() {
23+
24+
USE_SERIAL.begin(115200);
25+
// USE_SERIAL.setDebugOutput(true);
26+
27+
USE_SERIAL.println();
28+
USE_SERIAL.println();
29+
USE_SERIAL.println();
30+
31+
for(uint8_t t = 4; t > 0; t--) {
32+
USE_SERIAL.printf("[SETUP] WAIT %d...\n", t);
33+
USE_SERIAL.flush();
34+
delay(1000);
35+
}
36+
37+
WiFiMulti.addAP("SSID", "PASSWORD");
38+
39+
40+
}
41+
42+
void loop() {
43+
// wait for WiFi connection
44+
if((WiFiMulti.run() == WL_CONNECTED)) {
45+
46+
http.begin("192.168.1.12", 80, "/test.html");
47+
48+
int httpCode = http.GET();
49+
if(httpCode) {
50+
USE_SERIAL.printf("[HTTP] GET... code: %d\n", httpCode);
51+
52+
// file found at server
53+
if(httpCode == 200) {
54+
http.writeToStream(&USE_SERIAL);
55+
}
56+
} else {
57+
USE_SERIAL.print("[HTTP] GET... failed, no connection or no HTTP server\n");
58+
}
59+
}
60+
61+
delay(1000);
62+
}
63+
64+
65+

0 commit comments

Comments
 (0)