blynkkk / blynk_Issues

6 stars 6 forks source link

Unable to blink virtual LED #59

Closed ebolisa closed 3 years ago

ebolisa commented 3 years ago

Hi, I assisted the webinar yesterday on the new version and later on tried a simple test: blink of a virtual LED. However, the led didn't blink (on my iOS), but if I used a label widget in place of the LED widget, I did receive 0s and 1s. Am I doing this wrong or is it a bug related to the LED widget?

define BLYNK_TEMPLATE_ID "TMP"

define BLYNK_DEVICE_NAME "Demo"

define BLYNK_FIRMWARE_VERSION "0.1.0"

define BLYNK_PRINT Serial

//#define BLYNK_DEBUG

define APP_DEBUG

include "BlynkEdgent.h"

WidgetLED led1(V1);

void blinkLedWidget() { if (led1.getValue()) { led1.off(); Serial.println("LED on V1: off"); } else { led1.on(); Serial.println("LED on V1: on"); } }

void setup() { Serial.begin(115200); delay(100);

BlynkEdgent.begin(); timer.setInterval(1000L, blinkLedWidget); }

void loop() { BlynkEdgent.run(); }

doom369 commented 3 years ago

Seems like iOS specific LED issue. We'll check.

eepetrash commented 3 years ago

I did receive 0s and 1s

@doom369 Are we removing the 0-255 LED range?

doom369 commented 3 years ago

@eepetrash I think it should depend on the DS min/max settings. So maybe LED example is not valid for blynk 2.0. @alexkipar how you did it on your side?

alexkipar commented 3 years ago

@doom369 same on my side as on ios, as led is the only widget I don't know how to apply to DS model.

@ebolisa you can send 0 and 255 (set them as min/max of DS) and it will work for now

ebolisa commented 3 years ago

@ebolisa you can send 0 and 255 (set them as min/max of DS) and it will work for now

Actually, I did try it before posting. Same results:

// V1 LED Widget is blinking void blinkLedWidget() { if (led1.getValue()) { //led1.off(); led1.setValue(0); Serial.println("LED on V1: off"); } else { //led1.on(); led1.setValue(255); Serial.println("LED on V1: on"); } }

doom369 commented 3 years ago

@ebolisa please make sure DataStream assigned to the widget has 0-255 min/max values. @vshymanskyy firmware should send 255 for led1.on(). Is that a firmware bug?

ebolisa commented 3 years ago

@boom369

@ebolisa please make sure DataStream assigned to the widget has 0-255 min/max values.

Not sure I'm following you. No such option with that widget on iOS. I can only select the color. Unless, I'm missing some here.

ebolisa commented 3 years ago

Ok, Got it!! Changed to V5 and worked!!

alexkipar commented 3 years ago

@ebolisa it should be connected with your data streams, have you checked them on web dashboard?

doom369 commented 3 years ago

@ebolisa in the new version, values are always truncated to the min/max of the datastream. So if you send 1000 into the V1 with max = 100, it will be cast to 100.

ebolisa commented 3 years ago

@alexkipar

@ebolisa it should be connected with your data streams, have you checked them on web dashboard?

Yes, Blynk 2.0 has has assigned datatypes to virtual pins. We just cannot use any pins as 1.0.

doom369 commented 3 years ago

@ebolisa correct. From one side - it complicates the setup. From the other side it gives more flexibility, especially when you have a fleet of similar devices.