[SOLVED] ESP8266 - Control Device from Blynk and local Nextion HMI

I’m working in my project for an Aquarium Controller.
Blynks solved in a fantastic way all internet access to control my Aquarium (Lights, Pumps, Wave Makers, Dosing…), even if I’m not in home.
But, my project includes a Nextion HMI to control the same but in home.

The problem I found is that the widgets used in Blynk (sliders and buttons), does’t include a way to take the initial status from ESP8266, in order to avoid collisions with any change made locally in the nextion HMI.

Any body can give a Hint in how to solve this?

It is all in the code. You need to take and synchronize the data inputs and feedback to the controls via your written code.

For example, say you have a value of 128 (half intensity) coming from your Nextion for a PWM pin connected to an LED and you want the corresponding slider (set on V0 and a range of 0-255) in Blynk App to register that value. You use the Blynk.virtualWrite(vPin, value):


int LEDvalue = 128; // or however you get that value into your code
Blynk.virtualWrite(V0, LEDvalue);  // Set a Slider on V0 to the setting determined by LEDvalue

This is just a simple reference, your code may get a bit complex if you are mixing and matching from two different input sources and structure.

This concept is also the same as synchronizing a physical Button with a button Widget:


1 Like

Thanks Gunner, I already solved the syncronization following your hints.

Thanks a lot!

1 Like

Hello Irossel can you post the code :grin:

@sony8943 FYI, this is a two year old topic. Please do not reopen old topics just to ask for handouts. Try Googling for some code ideas :stuck_out_tongue:

1 Like