Categories
Development

Reading data from ESP32 to Blynk app

Let’s see how to get data from the ESP32 board.

This time we will not bother with testing on the ESP32 since it would be just blinking the LED every 1 second and we already did it.

So let’s just create a new project with virtual LED. The steps are similar to what we did in our first project, but we have to select LED from widget box selection and name it V0

virtual LED setup with the name V0
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

char auth[] = "blynk_auth_token";
char ssid[] = "ssid_name";
char pass[] = "wifi_password";

WidgetLED led(V0);

void setup() {
  Blynk.begin(auth, ssid, pass);
}

void loop() {
  Blynk.run();
  led.on();
  delay(1000);
  led.off();
  delay(1000);
}

The idea is to blink the virtual LED in the mobile application from the ESP32 application. Delay should be 1 second.

Program ESP32 and run the project on the mobile.

We can see how the virtual LED is blinking, but the delay between blinks is far from 1 second. So what is happening?

Here is one important lesson we need to know. The communication between application on the mobile and ESP32 is not direct, but through Blynk cloud which means ESP32 is sending data to the cloud and Blynk application is reading this data. In between some delays appear due to traffic on the internet and it is really hard to predict how much delay will there be between blinks.

Leave a Reply

Your email address will not be published. Required fields are marked *