I have made a very simple on/off button for an LED on an ESP32 espressif 32d dev board.
Attempts at controlling the LED state from the dashboard or the application leads to inconsistent responsiveness, sometimes the button responds, sometimes not and either remains on or off no matter how many times the button is clicked.
Resetting the board doesn’t help.
This is my code:
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
char auth[] = BLYNK_AUTH_TOKEN;
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "xxx";
char pass[] = "xxx";
// This function will be called every time Slider Widget
// in Blynk app writes values to the Virtual Pin V1
BLYNK_WRITE(V0)
{
int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable
digitalWrite(15, pinValue);
}
void setup()
{
// Debug console
Serial.begin(115200);
pinMode(15, OUTPUT);
//Blynk.begin(auth, ssid, pass);
// You can also specify server:
Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
}
void loop()
{
Blynk.run();
}
I have one datastream as a virtual pin V0
Blynk version is the current latest, downloaded as ZIP from github.
ESP32 library version 1.0.0, I had to downgrade the version otherwise Blynk wouldnt connect.
My guess is that you’re using the wrong url for the ESP32 core in your IDE’s Preferences settings.
You should be running version 2.0.5 or 2.0.6 (which was released a few days ago) of the ESP32 core.
If you still have problems connecting when you’ve done this, and made the changes that @John93 has mentioned, then take a look at your compiler output. You may be using an old version of WiFi.h
how do I check if it’s a network issue? Is there any way I can diagnose this with another application?
I’ve specified server and port in an endeavor to make my LED respond
No, not really. Your ISP may be blocking the Blynk protocol, although it’s difficult to say without seeing your serial output, and as no other application will use the Blynk protocol the 9nky way to test is with Blynk.
You don’t need to do this if you have the three lines of Firmware Configuration code at the top of your sketch, so take @John93’s advice and remove them.