Created
January 21, 2020 16:04
-
-
Save tranphuquy19/8ecd352c7f0366e75cfc753d0ac61a6b to your computer and use it in GitHub Desktop.
Note NodeMCU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (WiFi.status() == WL_CONNECTED) | |
{ | |
HTTPClient http; | |
http.begin(mcuEndpoint); | |
int httpStatusCode = http.GET(); | |
if (httpStatusCode > 0) | |
{ | |
String payload = http.getString(); | |
int result = payload.toInt(); | |
Serial.print(result); | |
if (0 == result) | |
{ | |
Serial.print('-'); | |
digitalWrite(lamp, HIGH); | |
delay(2000); | |
digitalWrite(lamp, LOW); | |
} | |
Serial.println(payload); | |
} | |
http.end(); | |
} | |
delay(6000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment