I have observed a strange issue with my blynk project. I have two IoT devices called NodeMCU (classic ESP8366 boards), a sender and a receiver.
My sender NodeMCU updates pin V1. It uses a classic Blynk.virtualWrite(V1, currentOption);.
My receiver NodeMCU waits for updates on V1 for doing some action (e.g. print “hello world”). It uses a classic WRITE(V1) even handled.
The connection does not seem to happen. Though, the Blynk server is updated by updates on V1 by the sender (I can see on my app, which connects V1 to a slider, that the slider value is accordingly updated). However, the event is not bounced back to the receiver. When I play with the Blynk app interface, the receiver do receive the event.
I could fix my way out, by having the receiver actively pulling for updates, by reguarly calling Blynk.syncVirtual(V1), but this seems to be the wrong way of handling that issue…
Could you please explain the step I missed, please?
Thank you for any support !
Could you elaborate a bit more?
When you said ‘node’ I initially thought you were using Node-Red, but having re-read what you’ve written I don’t think you are.
Are these two devices using the same Auth code, or are you using Bridge?
Thanks for your interest.
My “nodes” are IoT devices (to be exact a NodeMCU, which pushed me towards using the term “node”). I updated the question accordingly.
The two NodeMCU are using the same Auth code.
Thank you PeteKnight! Yes, this sounds like a very good explanation!
I started it but I am not certain of the process… If I want to proceed, I have to create a shared link for 1000 energy, and give it as a key for the brige. Is that right?
No, sharing is about sharing your project with another user, in read-only mode (as far as being able to edit the app layout is concerned) so something completely different.
Actually for what you want to do, it might be worth you looking at MQTT messaging, but you’ve not actually explained very much about your overall project.
as @Emilio requested, if you post both codes (properly formatted please), it may be easier for us to give advice.
Using a Blynk.virtualWrite(Vpin, value) does not automatically run the BLYNK_WRITE(Vpin) function. You need to call a Blynk.syncVirtual(Vpin) after the Blynk.virtualWrite(Vpin, value) in order to trigger the the BLYNK_WRITE(Vpin) function.
The question becomes whether the Blynk.syncVirtual on the sender will trigger a BLYNK_WRITE to both the sender and receiver. It may. However, this still seems rather hokey. Unless there’s a strong justification for two devices sharing the same auth token, I think the answer is the Bridge widget.
Thank you guys for your replies.
As a matter of an experiment, Blynk.syncVirtual(Vpin) only updates the value of the unit firing this function, not fo both.
Further studying the bridge widget, I think that Wickedbeernut is right. The bridge widget seems to be the tool to be used for my project. Though, such a widget implies creating another project, which costs extra money, right?
Generally yes… but not necessary, as the Bridge is based on the Auth. So as long as all the devices have their own Auth, whether in one or many projects (and on same account), then the Bridge can be used to allow one device’s code to control or send data to another device.
No… the energy you have is like a pile of LEGO, you can use it all on one big project, or many smaller projects… and take some or all apart to make something new.
Then as you grow in experience, you can add more energy and make bigger, more or both.
Interesting! Auth tokens are associated with projects (and to an extent, “apps”). I never considered using the Bridge widget to bridge projects. I just assumed the Bridge widget was used to communicate between devices associated with the same project.
I use dynamic auth token provisioning which doesn’t support the Bridge widget (and vice versa). I had assumed the Bridge widget isn’t supported on the “business side” of Blynk for this reason.
I use it to display outside Temp and Humidity from a Solar Monitoring project across to two other independent inside temperature reading projects. Each uses different hardware and sensors, so I kept the projects separate as well.
I have never used Bridge across devices in a single project… guess I couldn’t come up with a use case.
As for this Topic, I am still unclear of the objective thus whether Bridging is a valid solution.
In this project, I aim to have some common state, which stores some bits of information about two devices (e.g. is there some light at my home). When one device is updated, I want to other to get the info and vice versa (i.e. a LED at each device hints about the amount of light at the other device). I also want to play with the app (e.g. for changing the color of the LED).
Wickedbeernut and you seem to have access to additional auth token. Could you please explain how to get them, please? I have trouble finding that steps on tutorials about Bridge…