History Graph Settings doesn't record when blynk app is off

Hi this is my first post, I’m tryng to use HTU21D sensor and a simple sketch

It seems that value are recorded on History graph only when the app is open… when app is off it join the last relevation with the new and connect the dots.
If I turn off arduino it doesn’t create the “black space” between off and on

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
#include <SimpleTimer.h>
#include <Wire.h>
#include "SparkFunHTU21D.h"
HTU21D myClimate;    //Instance of HTU sensor
int t;
int h;
SimpleTimer timer;
char auth[] = "dblablabla";
void setup()
{
 Serial.begin(9600);
 Blynk.begin(auth, "blynk-cloud.com", 8442);
  myClimate.begin();
  timer.setInterval(3000L, currentTemp); 
}
void currentTemp() {
  float celsiusTemp = myClimate.readTemperature();
 // celsiusTemp = (celsiusTemp * 9.0) / 5.0 + 32.0; //convert to fahrenheit
  t = celsiusTemp;
  h = myClimate.readHumidity();
}
//Temperature Display
BLYNK_READ(0) {  
  Blynk.virtualWrite(0, t);
}
//Humidity Display
BLYNK_READ(1) {  
  Blynk.virtualWrite(1, h);
}
void loop()
{
  Blynk.run();
  timer.run();
}
[/quote]

That’s correct. See http://docs.blynk.cc/#blynk-main-operations-get-data-from-hardware. BLYNK_READ is only for active app.

if you want that the value is keep recorded in History Graph (regardless the app On/Off), do not use BLYNK_READ() instead just put the Blynk.virtualWrite(V0, t); and Blynk.virtualWrite(V1, h); inside the currentTemp() function, later on you can use Display Widget on V0 for temperature and V1 for humidity.

Here are the example code for that:

void currentTemp() {
  float celsiusTemp = myClimate.readTemperature();
 // celsiusTemp = (celsiusTemp * 9.0) / 5.0 + 32.0; //convert to fahrenheit
  t = celsiusTemp;
  h = myClimate.readHumidity();
  Blynk.virtualWrite(V0, t); // set Display Widget on V0 to display temperature (if you want to)
  Blynk.virtualWrite(V1, h); // set Display Widget on V1 to display humidity (if you want to)
}


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

thank you very much to all! :slight_smile:

I’ll do these mod and I’ll try in the afternoon

thanks, it works!
some questions:

  • it’s possible join various “arduino + sensor temp” in one page?
  • can I define how many reads have sensor to do when app if OFF?

Yes you can use several Arduino in one Blynk apps project, as long every sketch (program) in each Arduino using the same Auth Code, but be careful not to use the same virtual Pin for every sensor (on different Arduino), so the will not conflicting each other.

Yes you can define the delay between sensor reads on following code:

3000L means 3000 milliseconds = 3 seconds it will execute the currentTemp function, change this number will change the interval of reading (as well displaying) the sensor.