再加入app的led時虛擬v1變成閃燈

Read this before creating new topic:

  1. Search forum for similar topics
  2. Check https://docs.blynk.io
  3. Add details :
    • Hardware model + communication type. For example: ESP32
    • Smartphone OS (iOS or Android) + OS version
    • Blynk server region
    • Blynk Library version
    • Post your FORMATTED sketch code. Remove your AUTH TOKEN from code. Don’t post screenshots
    • Post your serial monitor output when experiencing some issues

:warning: If you don’t format your code, your topic can be deleted by moderators.

Here is a correct example of code formatting:

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = "wgb1tCxb2octL4uwmztOds4WclBLDenV";
char ssid[] = "IOT";
char pass[] = "0939201239";
WidgetLED ledV1(V1);
int vpin_value;

BLYNK_CONNECTED() {
  Blynk.syncVirtual(V0);
}

BLYNK_WRITE(V0) {
  vpin_value = param.asInt();
  Serial.println(vpin_value);
}

void setup(){
  Serial.begin(9600);
   Blynk.begin(auth, ssid, pass,"blynk.cloud",8080);
  pinMode(2, OUTPUT);
  pinMode(4, OUTPUT);
}

void loop(){
  Blynk.run();
  digitalWrite(2,LOW);

  if (vpin_value == 1) {
    digitalWrite(4,HIGH);
    ledV1.setColor("#ff0000");
    ledV1.on();

  }
  digitalWrite(4,LOW);
  ledV1.setColor("#ff0000");
  ledV1.off();

}

I’m not sure what your question or issue is because you haven’t provided any useful information, but you need to read this and fix your void loop…

Pete.

謝謝你,新手學習中