BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       👉 SKETCH BUILDER

Issue on new blynk,

I tried this coding on old blynk and it works well, but when jump into new blynk the control cannot operate.

#define BLYNK_TEMPLATE_ID ""
#define BLYNK_DEVICE_NAME ""
#define BLYNK_AUTH_TOKEN ""
  #define BLYNK_PRINT Serial
const byte led= 2;
  
  #include <WiFi.h>
  #include <WiFiClient.h>
  #include <BlynkSimpleEsp32.h>
  char auth[] = BLYNK_AUTH_TOKEN;
  char ssid[] = "";
  char pass[] = "";
  void setup() {
    pinMode(led, OUTPUT); 
  Serial.begin(115200);
    delay(10); 
    Blynk.begin(auth, ssid, pass);
  
  }
    
  void loop() {
  Blynk.run();
    }   

Do you mean that your device is online but the LED is not working, or that you’re trying to connect your device to the cloud with no success ?

yup successfully connected to the blynk, but when I push button from blynk web, led not reflected (still low) .

I guess you’re using a digital pin datastream. If that’s the case, then I highly recommend using virtual pins instead.
https://docs.blynk.io/en/blynk.edgent-firmware-api/virtual-pins

I tried the virtual pin , but still same.

Posting the updated sketch might help.

#define BLYNK_TEMPLATE_ID ""
#define BLYNK_DEVICE_NAME ""
#define BLYNK_AUTH_TOKEN ""
  #define BLYNK_PRINT Serial
const byte led= 2;
  
  #include <WiFi.h>
  #include <WiFiClient.h>
  #include <BlynkSimpleEsp32.h>
  char auth[] = BLYNK_AUTH_TOKEN;
  char ssid[] = "";
  char pass[] = "";
  void setup() {
    pinMode(led, OUTPUT); 
  Serial.begin(115200);
    delay(10); 
    Blynk.begin(auth, ssid, pass);
  
  }
    
  void loop() {
  Blynk.run();
    }   

Check this example

1 Like

For virtual pins to work, you need to have additional code that is triggered when the virtual pin is pressed.
This consists of callback functions with the name ’BLYNK_WRITE(vPin)’ where ’vPin’ is the virtual PIN number of your datastream.

Read this for more info…

Pete.

1 Like

thank you so much

thanks

1 Like