Blynk app reports ESP32 "Wasn't online yet"

Hi there. I am rookie in IoT projects.

So, for my project, I am trying to build a simulation of parking sensor with ESP32 System-on-Chip, connected on the Blynk App via WiFi.

For the hardware I have:
- ESP32 SoC
- Generic distance sensor
- board + jumper wires
- Huawei smartphone with Android 9.0

So far, I’ve uploaded my code onto the ESP32 with the auth code, the ssid and pass from my home network (as you can see from the code below)

These are the parameters from the batch file:

set COMM_PORT=COM3
set COMM_BAUD=9600
set SERV_ADDR=139.59.206.133
set SERV_PORT=80

The IP address is the same one from blynk-cloud.com when I used the unix command ping blynk-cloud.com

My biggest issue right now is that I cannot connect my smartphone to the Blynk server, no matter what I do. The device stays offline throughout the whole time (it shows the infamous wasn’t online yet ). I don’t have any antivirus program, and the firewall is turned off.

This is my output after I run the Batch file from the Blynk scripts.

Inside the Blynk app, there is only label - value display that will show the measured distance from the sensor. The label is set to Virtual pin V5 and the frequency is set to PUSH

I would gladly use any help, or any kind of modification on the code.
Thank you in advance.

Cheers and happy holidays!

This is my code below from the Arduino IDE:


#include <Blynk.h>
#include <Ultrasonic.h>


#define TRIGGER 4
#define ECHO    5

//#define BLYNK_PRINT DebugSerial 
//#define BLYNK_DEBUG 
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

// Get Auth Token in the Blynk App.
char auth[] = "8SGB7Vzu336R9eKbmnUqV-WPnq47XHdy";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Tone Bandits";
char pass[] = "dzoandernesto7";

BlynkTimer timer;

long duration, distance;

void timerEvent(){
   findD();
   
//   Serial.print(distance);
//   Serial.println("Centimeter: ");
   Blynk.virtualWrite(V5, distance);
}

void setup() {
//  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
  pinMode(TRIGGER, OUTPUT);
  pinMode(ECHO, INPUT);
  pinMode(BUILTIN_LED, OUTPUT);
  timer.setInterval(1000L, timerEvent);
}

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

void findD(){
    digitalWrite(TRIGGER, LOW);  
    delayMicroseconds(2);
    digitalWrite(TRIGGER, HIGH);
    delayMicroseconds(10);
    digitalWrite(TRIGGER, LOW);
    duration = pulseIn(ECHO, HIGH);
    distance = duration * 0.034/2;
}

I rairly log in here anymore, so cannot help with the rest, but this part I am very familiar with…

And this part is just confusing your issues… The USB link is only for older Arduino boards like UNO or MEGA… in order to use the PC as a USB/Serial-to-TCP adapter and get those older boards “online”… and absolutely unnecessary when using any ESP board that has its own WiFi.

1 Like