BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

LED and LCD widgets

Hello,

Can anyone please explain me the following?

WidgetLED led1 (V1);

Have I always to use 1 to 1?
What I mean, WidgetLED led3 (V3)
So hear 3 to 3

Thanks

Hello. No. led1 and led3 are just variable names. It could be anything.

The V reference can be 0 to 31 or 0 to 127 if you have a decent MCU. They are not tied to the name you give to the LED. So the following would be fine:

WidgetLED motorLED(V15);
WidgetLED trainLED(V22);

Thank you all!!!

Hello again,

is it possible, when i use ESP8622 with virtual button (GPIO13) to control an RELAY, that when i push the button
an virtual LED will switch on?

actually i have my code not hear, but i try to explin.

Bevor Setup () i make widgetLED led1(V1)

In Setup () i define with pinMODE (13,OUTPUT)

In Loop () i call void checkpin

In void checkpin i make: if (13==HIGH) {led1.on)}

but it doesn´t run.

Can someone tell me what i make false?

Thanks in advace.

Yes Blynk can do all what you want and much, much more.

The best way is not to tie relays to GPIO’s in the app and tie it to a virtual pin. Virtual pins are “magic” and give much more flexibility over physical pins.

I will post a link to a sample sketch shortly.

@Tom please study the sketch called LED_Relay.ino at Blynk for Beginners and help with your project

Hello Costas,

why not control relays via Virtual button which triggers GPIO´s?

It would be great if you can sent me the link.

Thanks

That is exactly what I said. Don’t tie relays to physical GPIO’s in the app, tie them to virtual pins.
The sketch should make it clear.

@Costas

sorry, i am a beginner. I want disturb you again.

I have to connect my relay to the Board, and trigger it via Blynk Button.

How should i connect my relay to the board if i should not connect it to physical GPIO?

Sorry for my perhaps stupid question.

in the app being the operative part. Of course you need to tie the physical relay to the physical pins, but not in the app as virtual pins are more flexible.

@Costas

okay now i see in the app that there are virutal pins. i will read about this virtual pins.

But one, i hope last question. With these virtual pin i can trigger an GPIO in physical?

Yes as per the sketch I created for you.

@Costas

For my better understanding, I use button with virtual pin via app, and these virtual pin triggers my gpio physically?

1 Like

Spot on. We recommend virtual pins because as you progress you will see that they can do more than physical pins. For example in the app if you tie it to say GPIO 13 you can’t do much else with it, but a button on V13 can control dozens of things.

For better understanding:

Blynk.virtualWrite(0, “CLOSE”);

means that virtual PIN 0 gives out “CLOSE” ?

Maybe, that line of code sends the text “CLOSE” to a Widget on V0. It will not do much other than display in a Terminal or Value Display widget (and LCD with modification).

Maybe this explains it better. You can do loads of things in a BLYNK_WRITE() that you can’t do with a digitalWrite().

BLYNK_WRITE(V0) // a Blynk virtual button
{
  int controlButton = param.asInt();
  if ( controlButton == 1){
    digitalWrite(a, b);
    digitalWrite(c, d);
    digitalWrite(e, f);
    //..............
    //..............
    //..............
    digitalWrite(x, y);
    Serial.println("Whatever you want");
    Blynk.virtualWrite(V1, a);
    Blynk.virtualWrite(V2, b);
    //..............
    //..............
    //..............    
    Blynk.virtualWrite(V127, zza);    
  } 
  else{
    // opposite of stuff in if statement etc
  }
}

What does the following “symbol position” mean?
Further do i need lcd.clear() before?

Where x is a symbol position (0-15), y is a line number (0 or 1),

@Tom your question is a bit random as we seem to have moved from LED to LCD.

The Blynk LCD is very much like most LCD displays, except Blynk’s is “free”.
Most physical LCD’s have 2 lines, although some do have 4.
Character positions are 0 to 15 on top row and same again for second row.

Using lcd.clear() obviously clears the display but you might not want to do that. Take the top row of 16 characters, you might want it like this:

23°C 13:39 56%

Temperature time and humidity. You can select which parts of the LCD to update if you don’t use the lcd.clear() command. You have to ensure that each “field” size remains constant though. So 56%, 59% etc is fine but not 57.7%. You can use “padding” of blank spaces but it does take a bit of doing.

@Costas

sorry i do not understand complete. The second number is for Line (0,1) okay.
But characters positions are 0 to 15 i do not understand. Can you please explain once again?

Thanks for you help and time!