BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Push value in app only updates when I leave/return or restart app

Hi All,

I made a simple script/circuit in which temp data is read and passed to the Blynk app. Seems to connect fine and the correct reading is displayed in the app. However, the temperature value does not update in the app unless I leave the app and return, or restart the app.

The temp sensor is the bmp180 and I am using the Adafruit library. Connected via I2C on pins 21 and 22.

In case it is relevant, I am using Google Pixel 3 phone.

I’ve read through the “keep the loop clean” and such. I am not using any delay() either. Below is the script I am using:

#include <Wire.h>
#include <Adafruit_BMP085.h>

#define BLYNK_PRINT Serial

#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

// Removed these and replaced with ZZZ, YYY, XXX
char auth[] = "ZZZ";
char ssid[] = "YYY";
char pass[] = "XXX";

Adafruit_BMP085 bmp;

BlynkTimer timer;

void setup() {
  Serial.begin(115200);

  Wire.begin(21,22); 

  bmp.begin();

  Blynk.begin(auth, ssid, pass);

  timer.setInterval(1000L, temp_reading);
}

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

void temp_reading(){
  float temp = bmp.readTemperature();
  Blynk.virtualWrite(V1, temp); 
  Serial.println(temp);
}

@MathPi please edit your post and add triple backticks ( ``` ) before and after your sketch.

1 Like

Thanks, done.

change this to ‘1’ only, no need for the ‘v’

It’s suppose to be V1, that’s not the problem.

Are you using the latest version of the Legacy app?

If so, the only solution may be to migrate to Blynk IoT (which you’ll need to do eventually anyway).

Pete.

2 Likes

Hi Pete. Last night I decided to ditch Blynk and go with the new Blynk IoT platform. With the new Blynk IoT app my simple project works right away. Cheers!

1 Like