Sending data without using timers

@Mohamed_Amr_Ali, i’ve wrote a simple example function for testing blynk api on esp8266.

please try it, and report back how it works. this function you can call from anywhere, you do not need blynk.run, neither blynk.begin. the only requirement is to have wifi internet connected. you can also send multiple values in the url string.

/*
    by wanek t, 2017.
    send data from esp8266 to blynk, using the blynk api. for more details, see:

    http://docs.blynkapi.apiary.io/#reference/0/write-pin-value-via-put/write-pin-value-via-get
    https://techtutorialsx.com/2016/07/17/esp8266-http-get-requests/

    include these 2 libs:
    #include <ESP8266WiFi.h>
    #include <ESP8266HTTPClient.h>
*/

void APIget()
{
  HTTPClient http;                                   // create http object

  String url = "http://blynk-cloud.com/";            // url
  url += "blynk token here";                         // your project token
  url += "/update/";
  url += "V14";                                      // pin to update
  url += "?value=";
  url += "HAHA";                                     // value to send

  http.begin(url);
  http.GET();
  delay(10);
  http.end();
}
2 Likes