Arduino connected to Blynk cloud but no change in phone app

Hi all,
I’m using Arduino Uno with Arduino Ethernet Shield 2 (W5500) with 1x DS18B20 temperature sensor.

When I open serial monitor, it connects to the Blynk cloud successfully, also on the app it says that the project is also connected and online but for some reason I am getting no change in values on the app.

My project settings are:
Board: Arduino Uno
Connection type: Ethernet

and I’ve set a gauge widget using V1 pin, as I’ve also configured it in the code.
I have the latest Blynk library version for Arduino and the latest version of the app on my phone.

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <SPI.h>
#include <Ethernet2.h>
#include <BlynkSimpleEthernet2.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 2

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

char auth[] = " xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ";


void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth);

  sensors.begin();
}

void sendTemps()
{
  sensors.requestTemperatures(); // Polls the sensors

  float tempC = sensors.getTempCByIndex(0); // Gets first probe on wire in lieu of by address

  Blynk.virtualWrite(V1, tempC);
}

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

Result from serial monitor on Arduino IDE:
[0] Getting IP…
[7259] IP:192.168.1.12
[7260]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ / '/
/
//_, /////_
/
__/ v0.5.2 on Arduino Uno

[7370] Connecting to blynk-cloud.com:80
[7592] Ready (ping: 57ms)

Result on phone app:

Everything seems to work, as programmed :stuck_out_tongue: !

You just forgot to set up timers, where sendTemps will be called.

2 Likes

Hey thanks for the reply,
I’m new to Blynk and I was just wondering would the timers be the reason as to why the values aren’t changing on my phone app? I’ll implement timers in my code later when I get home :slight_smile: thanks again.

Yes, because your sendTemps function, where the temperature is read and sent is never called to do the job!
Look at examples, how BlynkTimer is meant to do the timing job. Those are essentially 3 lines of additional code:

  • BlynkTimer timer;
  • timer.setInterval(1500L, sendTemps);
  • timer.run();

put those in the correct places and it should work

1 Like

Okay, thanks for the help, much appreciated :smiley: