Sending console information to blynk

This is the code:

#define BLYNK_TEMPLATE_ID "TMPL2y5rcnZI-"
#define BLYNK_TEMPLATE_NAME "espas32"
#define BLYNK_AUTH_TOKEN "YWXg5asenBNMGVBPNnS-xH7HfPVvIcPe"
#define BLYNK_PRINT Serial

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

char ssid[] = "Wokwi-GUEST";
char pass[] = "";

int Trig_pin =5;
int Echo_pin =18;
long duration;
float Speed_of_sound =0.034;
float dist_in_cm;

BlynkTimer timer;
void setup()
{
  Serial.begin(115200);
  pinMode(Trig_pin, OUTPUT);
  pinMode(Echo_pin,INPUT);
  timer.setInterval(1000L, sensorDataSend);
  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
}
void loop()
{
  Blynk.run();        
  timer.run();        
}

void sensorDataSend() {
  digitalWrite(Trig_pin, LOW);
  delayMicroseconds(2);
  digitalWrite(Trig_pin, HIGH);
  delayMicroseconds(10);
  digitalWrite(Trig_pin,LOW);

  duration =pulseIn(Echo_pin,HIGH);

  dist_in_cm=duration*Speed_of_sound/2;
  if (dist_in_cm < 15.0){
    Serial.print("distance in cm :");
  Serial.println(dist_in_cm);
  }

  Blynk.virtualWrite(V3, dist_in_cm);
}

When I run it it works normally, the Blynk device is online but it doesn´t show up on the gauge.

It’s your serial monitor output you need to post, not your sketch.

Pete.

this is what the monitor prints:

ets Jul 29 2019 12:21:46

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1156
load:0x40078000,len:11456
ho 0 tail 12 room 4
load:0x40080400,len:2972
entry 0x400805dc
[1179] Connecting to Wokwi-GUEST
[2922] Connected to WiFi
[2923] IP: 10.10.0.2
[2924] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v1.3.2 on ESP32

 #StandWithUkraine    https://bit.ly/swua


[2935] Connecting to blynk.cloud:80
[3601] Redirecting to ny3.blynk.cloud:80
[3607] Connecting to ny3.blynk.cloud:80
[4101] Ready (ping: 91ms).
distance in cm :6.99
distance in cm :7.06
distance in cm :6.97
distance in cm :6.97
distance in cm :7.02
distance in cm :6.97

Are you using the web console or the Blynk app?
If it’s the web cons9le, are you looking at the template view or the device view?

Pete.

What do you mean?
I have a template and inside of it I have the device, and im looking at its dashboard.

When you are in the Template screen - where you design the web dashboard - the values shown aren’t real values, they are simply random values within the datastream min/max range to help you visualise the data.
Once you go to one of the devices that are based on that template you’ll see actual values.

My question was, if you’re using the web dashboard, are you looking at the dashboard design screen in the template view, so seeing artificial values?

Pete.

Yes im seeing the artificial values, how do I get to see the real ones

Go to Device view.

Pete.

Where could I find this view option?

Pete.

We went in that option, clicked my device and im looking at the dashboard, the values are not the values printed.

In that case you weren’t looking at the dummy data shown in the the dashboard design screen of the Tempate view.

What happens if you move this line up…

so that it’s immediacy after…

and therefore inside the same if block of code that is producing your serial output?

Pete.

I did that and nothing changed, but I still think im not looking at the right information, could you give a step by step explanation on how to see.

Why don’t you use the mobile app if you find the web console confusing?

Pete.

1 Like

I used the mobile app and it works now, thanks for all the support you gave if I don’t have any more queries this is the end of our communication. Thanks again for the help you gave me in this project.

1 Like

Now you have the mobile app working, go back to the web console and try to figure-out what the issue was.
Maybe post some screenshots if you can’t get to the bottom of the issue.

Pete.

1 Like

I realized I was looking in the wrong place in the web console, now it’s working though. Thanks again.

1 Like