Read HTTP....,...,.,.../api/v1/data in blynk app

i dont know anymore.
I wait for help, all i wanne do is print every 30 seconds to the blynk app

#define BLYNK_PRINT Serial
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <ESP8266HTTPClient.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "M***********Hye";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "te**********6";
char pass[] = "aK***********ny";
BlynkTimer timer;
 HTTPClient http;  


void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
 
    

    http.begin("http://19*************/api/v1/data");  //Specify request destination
    int httpCode = http.GET();                                  //Send the request
  
    if (httpCode > 0) ; //Check the returning code
 
      String payload = http.getString();   //Get the request response payload
      Serial.println(payload);             //Print the response payload
      Blynk.virtualWrite(V6, (payload));
    delay(30000);
     return;
 
 
  


}
void loop()
{
  Blynk.run();
  timer.run();
}

This has to go!

Pete.

thanks, but him print only 1 time.
I like to print the *****api/v1/data every 30 seconds

i try many things with this one too ,

timer.setInterval(30000L, sendSensor); ,chang words to much , nothing works

thanks for helping me soo far

That’s because your code which calls this API is in your void setup, which executes once on startup.

You need to define a timer to call a function, and put your API call in that function.

It’s all explained in the “keep your void loop clean” document which you need to revisit.

Pete.

i read more tommorow.
Its hard for a biginner :wink:
thanks men

what is the value for my http?
// You can send any value at any time.
i realy need to stop for today :slight_smile:

jimmy


BlynkTimer timer;
 HTTPClient http; 


void myTimerEvent()
{
  Blynk.virtualWrite(V6,); // You can send any value at any time.?????????????????????
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V6, millis() / 1000);
}

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
 
    

    http.begin("http://19`********7/api/v1/data");  //Specify request destination
 int httpCode = http.GET();                                  //Send the request
   
    if (httpCode > 0) ; //Check the returning code
 
      String payload = http.getString();   //Get the request response payload
      Serial.println(payload);             //Print the response payload
     

  timer.setInterval(1000L, myTimerEvent);



}
void loop()
{
  Blynk.run();
  timer.run();
}
´´´´

Yes, you do.
I suggest that you re-read this…

Pete.

arduino makes me addicted :grin:
I try tomorrow more :slightly_smiling_face:

wow,Now i have nothing anymore, i dont inderstand the function.
I try tommorow Dutch speaking/reading to understand this part.(function)
And watch more video’s about explane the code.
thanks so much,
i dont give up :slight_smile.

Now i have this code.
i see empty spaces at every 10 seconds now, just see the time. :::::::

19:32:17.719 -> ___ __ __
19:32:17.766 -> / _ )/ /_ _____ / /__
19:32:17.820 -> / _ / / // / _ / '/
19:32:17.820 -> /
//_, /////_
19:32:17.867 -> /
__/ v0.6.1 on ESP8266
19:32:17.920 ->
19:32:17.920 -> [4550] Connecting to blynk-cloud.com:80
19:32:17.967 -> [4727] Ready (ping: 55ms).
19:32:28.091 ->
19:32:37.993 ->
19:32:47.980 ->
19…and many more times

BlynkTimer timer;
HTTPClient http;


void myTimerEvent()
{
  http.begin("http://19*********/api/v1/data");  //Specify request destination
  int httpCode = http.GET();

  if (httpCode > 0) ; //Check the returning code
    String payload = http.getString();   //Get the request response payload
    Serial.println(payload);             //Print the response payload//Send the request

  Blynk.virtualWrite(V6, (payload)); // You can send any value at any time.?????????????????????
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V6, millis() / 10000);
}

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);

    timer.setInterval(10000L, myTimerEvent);

  }
  void loop()
  {
    Blynk.run();
    timer.run();
  }