Skip to content

Instantly share code, notes, and snippets.

@tranphuquy19
Created January 21, 2020 16:04
Show Gist options
  • Save tranphuquy19/8ecd352c7f0366e75cfc753d0ac61a6b to your computer and use it in GitHub Desktop.
Save tranphuquy19/8ecd352c7f0366e75cfc753d0ac61a6b to your computer and use it in GitHub Desktop.
Note NodeMCU
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