You should have a new email in your inbox from the IFTTT service with the values you’ve defined in the previous step. The event should be successfully triggered, and you’ll get a green message saying “ Event has been triggered”.ĥ. In the Arduino IDE serial monitor, you should see an HTTP response code of 200 (this means that the request has succeeded).Ĥ. Then, the following lines print the server response code. ![]() Here’s a sample HTTP POST request with JSON data: POST /update HTTP/1.1 Int httpResponseCode = http.POST(httpRequestData) If ((millis() - lastTime) > timerDelay) " Send an HTTP POST request every 10 seconds Random seed is a number used to initialize a pseudorandom number generator Serial.println("Timer set to 10 seconds (timerDelay variable), it will take 10 seconds before publishing the first reading.") Serial.print("Connected to WiFi network with IP Address: ") For a final application, check the API call limits per hour/minute to avoid getting blocked/banned THE DEFAULT TIMER IS SET TO 10 SECONDS FOR TESTING PURPOSES Domain Name with full URL Path for HTTP POST Request (see in Tools > Boards > Boards Manager > ESP8266)Ĭonst char* ssid = "REPLACE_WITH_YOUR_SSID" Ĭonst char* password = "REPLACE_WITH_YOUR_PASSWORD" The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.Ĭode compatible with ESP8266 Boards Version 3.0.0 or above Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files. In this example, the ESP8266 makes an HTTP POST request to send a new value to ThingSpeak.Ĭopy the next sketch to your Arduino IDE: /*Ĭomplete project details at Complete project details at Finally, modify our examples to integrate with any API you want to use. Then, you need the server name (URL or IP address), and parameters to send in the request (URL path or request body). In summary, to make this guide compatible with any service, you need to search for the service API documentation. All examples presented in this guide also work with other APIs. If you prefer to learn with a local solution you can use HTTP with Node-RED. In this guide, you’ll learn how to setup your ESP8266 NodeMCU board to perform HTTP requests to ThingSpeak and.
0 Comments
Leave a Reply. |