Digital pin widget

I thought that by selecting digital pin I will see the states of the pins, but nothing changes :thinking:

15-028342

You aren’t getting confused between the D numbers on the Blynk digital pins and the D numbers printed on the NodeMCU are you?

Pete.

1 Like

I do not know how to use this D numbers :smile:
I thought this was GPIO?

The D number in the app is GPIO.
Your pin in the top left of the picture - I think labelled Relay2 is GPIO16
The one next to it (Relay1 ?) is GPIO5

I was just wondering if you mixed these up when you set-up your labelled value widgets?

Pete.

1 Like

Yes I would like to see the state of nodemcu pin at boot

Yes Rly 1 is D1 so GPIO5 and Rly 2 is D0 so GPIO16

I could read pin with digital read
but I don’t have any available pin to display the values :smile:
and Blynk.virtualWrite(V128, value) isn’t supported :thinking:

I’ve just been doing some playing around with a Sonoff that’s running some Blynk code.

If I put a labelled value widget on GPIO 12 (the relay) it stops the Sonoff from working.
If I swap that for a Buton widget then the Sonoff works, but the button doesn’t update when I operate the relay using the physical switch. If I toggle the button widget then the relay toggles!

If you’ve run out of V-pins then you could add another device and use Bridge to update them.

Or use terminal to show the data?

Pete.

1 Like

I have the same issue !

1 Like

I think you have to remove the V for it to work for vPins above 127

1 Like

I will try but I remember I have used label widget with blynk.virtualWrite(128, value) and it doesn’t display anything.
I will try again.

I don’t see anything above 127,

I can currently use it with Python… haven’t tested recently with C++… but I seem to recall doing so in recent past.

blynk.virtual_Write(128, 'OFF')

image image

1 Like

Very interesting, I’ll test before going to sleep.
:grin::crescent_moon:

Even works with API…

http://10.10.3.13:8080/5fb55413762b400cbb979111b630b9af/update/V128?value=hia

image

1 Like

Device selector reduces repeated widgets.

1 Like

My bad. I was looking at BLYNK_WRITE(pin) where pin <= 127. I don’t see a restriction with Blynk.virtualWrite. It seems to pass whatever value you specify. If the server accepts values greater than 127, you should be good.

    template <typename... Args>
    void virtualWrite(int pin, Args... values) {
        char mem[BLYNK_MAX_SENDBYTES];
        BlynkParam cmd(mem, 0, sizeof(mem));
        cmd.add("vw");
        cmd.add(pin);
        cmd.add_multi(values...);
        static_cast<Proto*>(this)->sendCmd(BLYNK_CMD_HARDWARE, 0, cmd.getBuffer(), cmd.getLength()-1);
    }
1 Like

What are you trying to do? Receive a value on the device from the server using the BLYNK_WRITE macro (which involves one and only one parameter … pin)? Or send a value from the device to the server?

to write a value to label widget on v128

Blynk.virtualWrite(128, "nok");

Right?

2 Likes

ooopss, I’m tired :smile: