質問編集履歴
5
誤記修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -160,21 +160,11 @@
|
|
160
160
|
|
161
161
|
Serial.println(ipadr); // シリアルモニタにIPアドレスを表示
|
162
162
|
|
163
|
+
|
164
|
+
|
163
|
-
|
165
|
+
Server.on("/", handleRoot); // IPアドレスのみのアクセス時はhandleRoot()を起動
|
164
|
-
|
166
|
+
|
165
|
-
|
167
|
+
Server.on("/RH", handleon(LED_R)); // IPアドレス+/Hの時 handleon()関数の起動を設定
|
166
|
-
|
167
|
-
server.on("/RL", handleoff(LED_R)); // IPアドレス+/Lの時 handleoff()関数の起動を設定
|
168
|
-
|
169
|
-
server.on("/GH", handleon(LED_G)); // IPアドレス+/Hの時 handleon()関数の起動を設定
|
170
|
-
|
171
|
-
server.on("/GL", handleoff(LED_G)); // IPアドレス+/Lの時 handleoff()関数の起動を設定
|
172
|
-
|
173
|
-
Server.begin(); // サーバを開始~~
|
174
|
-
|
175
|
-
//server.on("/", handleRoot); // IPアドレスのみのアクセス時はhandleRoot()を起動
|
176
|
-
|
177
|
-
server.on("/RH", handleon(LED_R)); // IPアドレス+/Hの時 handleon()関数の起動を設定
|
178
168
|
|
179
169
|
Server.on("/RL", handleoff(LED_R)); // IPアドレス+/Lの時 handleoff()関数の起動を設定
|
180
170
|
|
@@ -196,8 +186,6 @@
|
|
196
186
|
|
197
187
|
// put your main code here, to run repeatedly:
|
198
188
|
|
199
|
-
~~server.handleClient(); // ブラウザへのアクセスに応じて適切な関数を起動処理する~~
|
200
|
-
|
201
189
|
Server.handleClient(); // ブラウザへのアクセスに応じて適切な関数を起動処理する
|
202
190
|
|
203
191
|
|
@@ -254,6 +242,12 @@
|
|
254
242
|
|
255
243
|
書き込み官僚となりましたが、文字が赤色でした。
|
256
244
|
|
245
|
+
⇒
|
246
|
+
|
247
|
+
回答者の方のアドバイスにより
|
248
|
+
|
249
|
+
ServerのSを小文字から大文字に変更しました。
|
250
|
+
|
257
251
|
|
258
252
|
|
259
253
|
### 補足情報(FW/ツールのバージョンなど)
|
4
誤記修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,11 +2,9 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
|
5
|
+
ESP8266を積んだNodeモジュールをArduinoとして使おうとしています。
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
|
7
|
+
|
10
8
|
|
11
9
|
ピリオドの前に何か問題があるということはわかりますが、
|
12
10
|
|
@@ -32,222 +30,222 @@
|
|
32
30
|
|
33
31
|
server.on("/RH", handleon(LED_R)); // IPアドレス+/Hの時 handleon()関数の起動を設定
|
34
32
|
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
ESP32_LED_Train:47:9: error: expected unqualified-id before '.' token
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
Server.begin(); // サーバを開始
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
^
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
D:\Arduino\ESP32_LED_Train\ESP32_LED_Train.ino: In function 'void loop()':
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
ESP32_LED_Train:53:9: error: expected unqualified-id before '.' token
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
Server.handleClient(); // ブラウザへのアクセスに応じて適切な関数を起動処理する
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
^
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
D:\Arduino\ESP32_LED_Train\ESP32_LED_Train.ino: In function 'void handleRoot()':
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
ESP32_LED_Train:61:9: error: expected unqualified-id before '.' token
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
Server.Send(200, "text/HTML", temp);
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
^
|
78
|
+
|
35
79
|
```
|
36
80
|
|
37
81
|
|
38
82
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
83
|
+
### 該当のソースコード
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
```ここに言語名を入力
|
88
|
+
|
89
|
+
#include <ESP8266WebServer.h>
|
90
|
+
|
91
|
+
#include <ESP8266WebServerSecure.h>
|
92
|
+
|
93
|
+
//#include <ESP8266WebServerSecureAxTLS.h>
|
94
|
+
|
95
|
+
//#include <ESP8266WebServerSecureBearSSL.h>
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
#include <SPI.h>
|
100
|
+
|
101
|
+
#include <WiFi.h>
|
102
|
+
|
103
|
+
#include <WiFiServer.h>
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
const char ssid[] = "SPWN_N34_3e32a6";
|
108
|
+
|
109
|
+
const char password[] = "6046e5d4b0d04";
|
110
|
+
|
111
|
+
WiFiServer server(80);
|
112
|
+
|
113
|
+
IPAddress ipadr;
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
#define LED_G 4
|
118
|
+
|
119
|
+
#define LED_R 5
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
void setup() {
|
124
|
+
|
125
|
+
// put your setup code here, to run once:
|
126
|
+
|
127
|
+
pinMode(LED_G, OUTPUT); // LED接続ポートを出力に設定
|
128
|
+
|
129
|
+
pinMode(LED_R, OUTPUT); // LED接続ポートを出力に設定
|
130
|
+
|
131
|
+
digitalWrite(LED_G, LOW); // 出力をLOWにしてLEDを消灯する
|
132
|
+
|
133
|
+
digitalWrite(LED_R, LOW); // 出力をLOWにしてLEDを消灯する
|
134
|
+
|
135
|
+
Serial.begin(9600); // シリアルモニタを115200bpsで初期化
|
136
|
+
|
137
|
+
WiFi.mode(WIFI_STA); // Wi-Fiのモードを設定
|
138
|
+
|
139
|
+
WiFi.begin(ssid, password); // 接続するSSID キーを指定してWi-Fiを開始
|
140
|
+
|
141
|
+
Serial.println("Now Connecting"); // シリアルプリントの出力改行のみ
|
142
|
+
|
143
|
+
while (WiFi.status() != WL_CONNECTED) { // 接続が完了するまで待つ
|
144
|
+
|
145
|
+
delay(500); // 各回500msの時間待つ
|
146
|
+
|
147
|
+
//Serial.print("."); // 待ち時間500msごとに1ドット表示 接続が完了すると抜ける
|
148
|
+
|
149
|
+
}
|
150
|
+
|
151
|
+
ipadr = WiFi.localIP();
|
152
|
+
|
153
|
+
Serial.println("");
|
154
|
+
|
155
|
+
Serial.print("Connected to "); // Wi-Fi接続を表示
|
156
|
+
|
157
|
+
Serial.println(ssid); // SSID表示
|
158
|
+
|
159
|
+
Serial.print("IP address: ");
|
160
|
+
|
161
|
+
Serial.println(ipadr); // シリアルモニタにIPアドレスを表示
|
162
|
+
|
163
|
+
~~ //server.on("/", handleRoot); // IPアドレスのみのアクセス時はhandleRoot()を起動
|
164
|
+
|
165
|
+
server.on("/RH", handleon(LED_R)); // IPアドレス+/Hの時 handleon()関数の起動を設定
|
166
|
+
|
167
|
+
server.on("/RL", handleoff(LED_R)); // IPアドレス+/Lの時 handleoff()関数の起動を設定
|
168
|
+
|
169
|
+
server.on("/GH", handleon(LED_G)); // IPアドレス+/Hの時 handleon()関数の起動を設定
|
170
|
+
|
171
|
+
server.on("/GL", handleoff(LED_G)); // IPアドレス+/Lの時 handleoff()関数の起動を設定
|
172
|
+
|
173
|
+
Server.begin(); // サーバを開始~~
|
174
|
+
|
175
|
+
//server.on("/", handleRoot); // IPアドレスのみのアクセス時はhandleRoot()を起動
|
176
|
+
|
177
|
+
server.on("/RH", handleon(LED_R)); // IPアドレス+/Hの時 handleon()関数の起動を設定
|
178
|
+
|
179
|
+
Server.on("/RL", handleoff(LED_R)); // IPアドレス+/Lの時 handleoff()関数の起動を設定
|
180
|
+
|
181
|
+
Server.on("/GH", handleon(LED_G)); // IPアドレス+/Hの時 handleon()関数の起動を設定
|
182
|
+
|
183
|
+
Server.on("/GL", handleoff(LED_G)); // IPアドレス+/Lの時 handleoff()関数の起動を設定
|
184
|
+
|
185
|
+
Server.begin(); // サーバを開始
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
Serial.println("HTTP server started");
|
190
|
+
|
191
|
+
}
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
void loop() {
|
196
|
+
|
197
|
+
// put your main code here, to run repeatedly:
|
198
|
+
|
199
|
+
~~server.handleClient(); // ブラウザへのアクセスに応じて適切な関数を起動処理する~~
|
200
|
+
|
201
|
+
Server.handleClient(); // ブラウザへのアクセスに応じて適切な関数を起動処理する
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
}
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
void handleRoot() {
|
210
|
+
|
211
|
+
String temp = "Click <a href=\"/RH\">here</a> to turn the LED RED on.<br />";
|
212
|
+
|
213
|
+
temp += "Click <a href=\"/RL\">here</a> to turn the LED RED off.<br />\n";
|
214
|
+
|
215
|
+
temp += "Click <a href=\"/GH\">here</a> to turn the LED GREEN on.<br />";
|
216
|
+
|
217
|
+
temp += "Click <a href=\"/GL\">here</a> to turn the LED GREEN off.\n";
|
218
|
+
|
219
|
+
~~server.send(200, "text/HTML", temp)~~;
|
220
|
+
|
221
|
+
Server.send(200, "text/HTML", temp);
|
222
|
+
|
223
|
+
}
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
void handleon(int led) {
|
228
|
+
|
229
|
+
digitalWrite(led, HIGH); // GET /H turns the LED on
|
230
|
+
|
231
|
+
handleRoot();
|
232
|
+
|
233
|
+
}
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
void handleoff(int led) {
|
238
|
+
|
239
|
+
digitalWrite(led, LOW); // GET /L turns the LED off
|
240
|
+
|
241
|
+
handleRoot();
|
242
|
+
|
243
|
+
}
|
80
244
|
|
81
245
|
```
|
82
246
|
|
83
247
|
|
84
248
|
|
85
|
-
### 該当のソースコード
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
```ここに言語名を入力
|
90
|
-
|
91
|
-
#include <ESP8266WebServer.h>
|
92
|
-
|
93
|
-
#include <ESP8266WebServerSecure.h>
|
94
|
-
|
95
|
-
//#include <ESP8266WebServerSecureAxTLS.h>
|
96
|
-
|
97
|
-
//#include <ESP8266WebServerSecureBearSSL.h>
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
#include <SPI.h>
|
102
|
-
|
103
|
-
#include <WiFi.h>
|
104
|
-
|
105
|
-
#include <WiFiServer.h>
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
const char ssid[] = "SPWN_N34_3e32a6";
|
110
|
-
|
111
|
-
const char password[] = "6046e5d4b0d04";
|
112
|
-
|
113
|
-
WiFiServer server(80);
|
114
|
-
|
115
|
-
IPAddress ipadr;
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
#define LED_G 4
|
120
|
-
|
121
|
-
#define LED_R 5
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
void setup() {
|
126
|
-
|
127
|
-
// put your setup code here, to run once:
|
128
|
-
|
129
|
-
pinMode(LED_G, OUTPUT); // LED接続ポートを出力に設定
|
130
|
-
|
131
|
-
pinMode(LED_R, OUTPUT); // LED接続ポートを出力に設定
|
132
|
-
|
133
|
-
digitalWrite(LED_G, LOW); // 出力をLOWにしてLEDを消灯する
|
134
|
-
|
135
|
-
digitalWrite(LED_R, LOW); // 出力をLOWにしてLEDを消灯する
|
136
|
-
|
137
|
-
Serial.begin(9600); // シリアルモニタを115200bpsで初期化
|
138
|
-
|
139
|
-
WiFi.mode(WIFI_STA); // Wi-Fiのモードを設定
|
140
|
-
|
141
|
-
WiFi.begin(ssid, password); // 接続するSSID キーを指定してWi-Fiを開始
|
142
|
-
|
143
|
-
Serial.println("Now Connecting"); // シリアルプリントの出力改行のみ
|
144
|
-
|
145
|
-
while (WiFi.status() != WL_CONNECTED) { // 接続が完了するまで待つ
|
146
|
-
|
147
|
-
delay(500); // 各回500msの時間待つ
|
148
|
-
|
149
|
-
//Serial.print("."); // 待ち時間500msごとに1ドット表示 接続が完了すると抜ける
|
150
|
-
|
151
|
-
}
|
152
|
-
|
153
|
-
ipadr = WiFi.localIP();
|
154
|
-
|
155
|
-
Serial.println("");
|
156
|
-
|
157
|
-
Serial.print("Connected to "); // Wi-Fi接続を表示
|
158
|
-
|
159
|
-
Serial.println(ssid); // SSID表示
|
160
|
-
|
161
|
-
Serial.print("IP address: ");
|
162
|
-
|
163
|
-
Serial.println(ipadr); // シリアルモニタにIPアドレスを表示
|
164
|
-
|
165
|
-
~~ //server.on("/", handleRoot); // IPアドレスのみのアクセス時はhandleRoot()を起動
|
166
|
-
|
167
|
-
server.on("/RH", handleon(LED_R)); // IPアドレス+/Hの時 handleon()関数の起動を設定
|
168
|
-
|
169
|
-
server.on("/RL", handleoff(LED_R)); // IPアドレス+/Lの時 handleoff()関数の起動を設定
|
170
|
-
|
171
|
-
server.on("/GH", handleon(LED_G)); // IPアドレス+/Hの時 handleon()関数の起動を設定
|
172
|
-
|
173
|
-
server.on("/GL", handleoff(LED_G)); // IPアドレス+/Lの時 handleoff()関数の起動を設定
|
174
|
-
|
175
|
-
Server.begin(); // サーバを開始~~
|
176
|
-
|
177
|
-
//server.on("/", handleRoot); // IPアドレスのみのアクセス時はhandleRoot()を起動
|
178
|
-
|
179
|
-
server.on("/RH", handleon(LED_R)); // IPアドレス+/Hの時 handleon()関数の起動を設定
|
180
|
-
|
181
|
-
Server.on("/RL", handleoff(LED_R)); // IPアドレス+/Lの時 handleoff()関数の起動を設定
|
182
|
-
|
183
|
-
Server.on("/GH", handleon(LED_G)); // IPアドレス+/Hの時 handleon()関数の起動を設定
|
184
|
-
|
185
|
-
Server.on("/GL", handleoff(LED_G)); // IPアドレス+/Lの時 handleoff()関数の起動を設定
|
186
|
-
|
187
|
-
Server.begin(); // サーバを開始
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
Serial.println("HTTP server started");
|
192
|
-
|
193
|
-
}
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
void loop() {
|
198
|
-
|
199
|
-
// put your main code here, to run repeatedly:
|
200
|
-
|
201
|
-
~~server.handleClient(); // ブラウザへのアクセスに応じて適切な関数を起動処理する~~
|
202
|
-
|
203
|
-
Server.handleClient(); // ブラウザへのアクセスに応じて適切な関数を起動処理する
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
}
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
void handleRoot() {
|
212
|
-
|
213
|
-
String temp = "Click <a href=\"/RH\">here</a> to turn the LED RED on.<br />";
|
214
|
-
|
215
|
-
temp += "Click <a href=\"/RL\">here</a> to turn the LED RED off.<br />\n";
|
216
|
-
|
217
|
-
temp += "Click <a href=\"/GH\">here</a> to turn the LED GREEN on.<br />";
|
218
|
-
|
219
|
-
temp += "Click <a href=\"/GL\">here</a> to turn the LED GREEN off.\n";
|
220
|
-
|
221
|
-
~~server.send(200, "text/HTML", temp)~~;
|
222
|
-
|
223
|
-
Server.send(200, "text/HTML", temp);
|
224
|
-
|
225
|
-
}
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
void handleon(int led) {
|
230
|
-
|
231
|
-
digitalWrite(led, HIGH); // GET /H turns the LED on
|
232
|
-
|
233
|
-
handleRoot();
|
234
|
-
|
235
|
-
}
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
void handleoff(int led) {
|
240
|
-
|
241
|
-
digitalWrite(led, LOW); // GET /L turns the LED off
|
242
|
-
|
243
|
-
handleRoot();
|
244
|
-
|
245
|
-
}
|
246
|
-
|
247
|
-
```
|
248
|
-
|
249
|
-
|
250
|
-
|
251
249
|
### 試したこと
|
252
250
|
|
253
251
|
|
3
語気修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,6 +6,16 @@
|
|
6
6
|
|
7
7
|
|
8
8
|
|
9
|
+
~~
|
10
|
+
|
11
|
+
ピリオドの前に何か問題があるということはわかりますが、
|
12
|
+
|
13
|
+
そのあたりのヘッダファイルをのぞいてみたりしましたが、
|
14
|
+
|
15
|
+
結局Grepなどを使ってもたどり着けませんでした。
|
16
|
+
|
17
|
+
|
18
|
+
|
9
19
|
### 発生している問題・エラーメッセージ
|
10
20
|
|
11
21
|
|
@@ -20,15 +30,7 @@
|
|
20
30
|
|
21
31
|
|
22
32
|
|
23
|
-
server.on("/RH", handleon(LED_R)); // IPアドレス+/Hの時 handleon()関数の起動を設定
|
33
|
+
server.on("/RH", handleon(LED_R)); // IPアドレス+/Hの時 handleon()関数の起動を設定
|
24
|
-
|
25
|
-
ピリオドの前に何か問題があるということはわかりますが、
|
26
|
-
|
27
|
-
そのあたりのヘッダファイルをのぞいてみたりしましたが、
|
28
|
-
|
29
|
-
結局Grepなどを使ってもたどり着けませんでした。
|
30
|
-
|
31
|
-
|
32
34
|
|
33
35
|
```
|
34
36
|
|
2
状況がすすんだため
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
ESP8266を積んだNodeモジュールをArduinoとして使おうとしています。
|
5
|
+
~~ESP8266を積んだNodeモジュールをArduinoとして使おうとしています。
|
6
6
|
|
7
7
|
|
8
8
|
|
@@ -20,7 +20,61 @@
|
|
20
20
|
|
21
21
|
|
22
22
|
|
23
|
-
server.on("/RH", handleon(LED_R)); // IPアドレス+/Hの時 handleon()関数の起動を設定
|
23
|
+
server.on("/RH", handleon(LED_R)); // IPアドレス+/Hの時 handleon()関数の起動を設定~~
|
24
|
+
|
25
|
+
ピリオドの前に何か問題があるということはわかりますが、
|
26
|
+
|
27
|
+
そのあたりのヘッダファイルをのぞいてみたりしましたが、
|
28
|
+
|
29
|
+
結局Grepなどを使ってもたどり着けませんでした。
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
```
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
ESP32_LED_Train:47:9: error: expected unqualified-id before '.' token
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
Server.begin(); // サーバを開始
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
^
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
D:\Arduino\ESP32_LED_Train\ESP32_LED_Train.ino: In function 'void loop()':
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
ESP32_LED_Train:53:9: error: expected unqualified-id before '.' token
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
Server.handleClient(); // ブラウザへのアクセスに応じて適切な関数を起動処理する
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
^
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
D:\Arduino\ESP32_LED_Train\ESP32_LED_Train.ino: In function 'void handleRoot()':
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
ESP32_LED_Train:61:9: error: expected unqualified-id before '.' token
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
Server.Send(200, "text/HTML", temp);
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
^
|
24
78
|
|
25
79
|
```
|
26
80
|
|
@@ -106,17 +160,31 @@
|
|
106
160
|
|
107
161
|
Serial.println(ipadr); // シリアルモニタにIPアドレスを表示
|
108
162
|
|
163
|
+
~~ //server.on("/", handleRoot); // IPアドレスのみのアクセス時はhandleRoot()を起動
|
164
|
+
|
165
|
+
server.on("/RH", handleon(LED_R)); // IPアドレス+/Hの時 handleon()関数の起動を設定
|
166
|
+
|
167
|
+
server.on("/RL", handleoff(LED_R)); // IPアドレス+/Lの時 handleoff()関数の起動を設定
|
168
|
+
|
169
|
+
server.on("/GH", handleon(LED_G)); // IPアドレス+/Hの時 handleon()関数の起動を設定
|
170
|
+
|
171
|
+
server.on("/GL", handleoff(LED_G)); // IPアドレス+/Lの時 handleoff()関数の起動を設定
|
172
|
+
|
173
|
+
Server.begin(); // サーバを開始~~
|
174
|
+
|
109
175
|
//server.on("/", handleRoot); // IPアドレスのみのアクセス時はhandleRoot()を起動
|
110
176
|
|
111
177
|
server.on("/RH", handleon(LED_R)); // IPアドレス+/Hの時 handleon()関数の起動を設定
|
112
178
|
|
113
|
-
|
179
|
+
Server.on("/RL", handleoff(LED_R)); // IPアドレス+/Lの時 handleoff()関数の起動を設定
|
114
|
-
|
180
|
+
|
115
|
-
|
181
|
+
Server.on("/GH", handleon(LED_G)); // IPアドレス+/Hの時 handleon()関数の起動を設定
|
116
|
-
|
182
|
+
|
117
|
-
|
183
|
+
Server.on("/GL", handleoff(LED_G)); // IPアドレス+/Lの時 handleoff()関数の起動を設定
|
118
|
-
|
184
|
+
|
119
|
-
|
185
|
+
Server.begin(); // サーバを開始
|
186
|
+
|
187
|
+
|
120
188
|
|
121
189
|
Serial.println("HTTP server started");
|
122
190
|
|
@@ -128,7 +196,11 @@
|
|
128
196
|
|
129
197
|
// put your main code here, to run repeatedly:
|
130
198
|
|
199
|
+
~~server.handleClient(); // ブラウザへのアクセスに応じて適切な関数を起動処理する~~
|
200
|
+
|
131
|
-
|
201
|
+
Server.handleClient(); // ブラウザへのアクセスに応じて適切な関数を起動処理する
|
202
|
+
|
203
|
+
|
132
204
|
|
133
205
|
}
|
134
206
|
|
@@ -144,7 +216,9 @@
|
|
144
216
|
|
145
217
|
temp += "Click <a href=\"/GL\">here</a> to turn the LED GREEN off.\n";
|
146
218
|
|
219
|
+
~~server.send(200, "text/HTML", temp)~~;
|
220
|
+
|
147
|
-
|
221
|
+
Server.send(200, "text/HTML", temp);
|
148
222
|
|
149
223
|
}
|
150
224
|
|
1
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
ESP8266を積んだNodeモジュールをArduinoとして
|
5
|
+
ESP8266を積んだNodeモジュールをArduinoとして使おうとしています。
|
6
6
|
|
7
7
|
|
8
8
|
|