Hi everyone.
The following method cause my esp8266 exception error and reboot when i press the button vpin 100
if i uncomment the line Blynk.virtualWrite(V73, 1023) or Blynk.virtualWrite(V73, 0);
v73 is a led on blynbk app. D8 high will close an external relay to start the fan. I really dont know why this happen. Any suggestion for this? Thanks
BLYNK_WRITE(V100) {
int pinValue = param.asInt();
if (pinValue == 1)
{
digitalWrite(D8, HIGH);
// Blynk.virtualWrite(V73, 1023);
}
else
{
digitalWrite(D8, LOW);
// Blynk.virtualWrite(V73, 0);
}
}
Hi,
You don’t need to Blynk.virtualwrite() to the Blynk LED Widget. Have a look at the LED Widget example sketch to see how you use it.
https://examples.blynk.cc/?board=ESP8266&shield=ESP8266%20WiFi&example=Widgets%2FLED%2FLED_Blink
You declare the widget:
WidgetLED led1(V1);
Then simply turn it On or Off:
led1.off();
led1.on();
Use the eamples
cul
billd
1 Like
The LED widget has 256 brightness levels (0-255) so Blynk.virtualWrite(V73, 255);
is what you’d normally use to turn an LED widget on to maximum brightness if you are using the virtualWrite approach as opposed to the led1.on()
approach described by Bill.
Pete.
1 Like
Thank you Bill and Pete
your helps solve my problems
Regards
1 Like
WidgetLED fanled(V23);
WidgetLED lcdled(V21);
BLYNK_WRITE(V100) {
int pinValue = param.asInt();
if (pinValue == 1)
{
digitalWrite(D8, HIGH);
fanled.on();// system crash , exception after 1 or 2 times button pressed
}
else
{
digitalWrite(D8, LOW);
fanled.off(); //system crash , exception after 1 or 2 times button pressed
}
but if i place this line fanled.on(); or fanled.off(); inside loop , it works without any problem.
this code is inside loop()
if (digitalRead(D8) == HIGH)
{
Blynk.virtualWrite(V100, 1);//toggle the button
fanled.on();
}
else
{
Blynk.virtualWrite(V100, 0);//toggle the button
fanled.off();
}
@Anthony_Chen please edit your post and use triple backticks at the beginning and end of your code, and remove the ‘>’ characters at the beginning of each line of code.
Triple backticks look like this:
```
Pete.
1 Like
What exactly is the exception error that you get when the crash occurs?
Have you tried decoding it with the exception decoder?
Pete.