const char* ssid = "ssid";
const char* password = "pass";
void setup()
{
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(1000);
Serial.println("Connecting...");
}
}
void loop()
{
if (WiFi.status() == WL_CONNECTED)
{
HTTPClient http; //Object of class HTTPClient
http.begin("http://localhost:56542/api/values/1");
int httpCode = http.GET();
Serial.print(httpCode);
if (httpCode > 0)
{
Serial.print("work:");
}else{
Serial.print("nor work:");
}
http.end(); //Close connection
}
delay(100);
}
I want to draw data from localhost from nodemcu, how can I do it while working in localhost visual studio?
http.begin (the "http: // localhost: 56542 / API / values / 1"); what does it mean -1, but I normally have data -1
Comments
Post a Comment