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

Can the Text Input widget be populated by the text on a file (Using Node-Red)?


#1

Hi all, new here. I’m working on a project that uses some Text Input fields. When a user types in a message, it gets written to a file by way of Node-Red. I am wondering if the Text Input field can get automatically populated, on start up (or any other way), with the contents of the previously saved file?

I am using Node-Red to write the file to a directory within an R-Pi Zero W.

I have tried using a File Read node to manipulate the Text Input field via a Blynk node, to no avail.

Any help would be greatly appreciated.

Thx.


#2

Yes… easy enough with a Blynk.virtualWrite(vPin, "Your text") command in a Arduino sketch.

Probably via API with Node-Red… ?

http://<IP>:<PORT>/<AUTH>/update/vPin?value=Your text


#3

i like gunners answer better than mine. I was going to go into the whole “which scripting language are you using” and "input output / pipe / linux event’s / tail -f " arena.

he hit the nail on the head, use the api.


#4

Thanks guys, will definitely look into using the API route. I am currently using R-Pi, just because that’s what I had on hand. I am not opposed to switching to the Arduino platform if everything Blynk will have better ability to control the UI/App from Node-Red or Arduino.

Thx.


#5

Blynk can handle them all… C++, NodeJS, Node-Red and even a bit of Python, just fine… it is the user base that is larger with Arduino/C++ than the other options… thus more resources to call upon as you learn.


#6

Great, thanks. Appreciate your input. I think I’ve got an Arduino UNO stashed around somewhere. :grinning:

Thx.


#7

You can actually test API without hardware. Since the API command talks to the Server and the Server to the App, you can control and read vPins without an MCU. Just create the project with whatever 'device" and grab the AUTH, then setup a widget or two with vPins and mess around with the API commands and syntax in a browser.

Virtual pins would use the V and corresponding number

<IP>:<PORT> with Cloud Server would simply be blynk-cloud.com

http://<IP>:<PORT>/<AUTH>/update/V0?value=Hello Blynker To send V0 the string “Hello Blynker”
http://<IP>:<PORT>/<AUTH>/get/V0 Get the value of V0

And finally, to change a property of a widget using virtual pins you would replace ‘value’ with the desired property. For example…

http://<IP>:<PORT>/<AUTH>/update/V1?color=%23ED9D00 Change widget on V1 colour to Yellow. NOTE: %23 replaces the usual #


#8

STOP!!!

Forget all the API stuff, it’s as simple as this:
image

Just push the text to a Write Node that’s connected to the Vpin of you text node and it populates your text input widget.

Pete.


#9

Well, it is about time the Node-Red expert showed… I was in the midst of designing a fusion powered API processing Arduino Mega powered (with ESP-01) URL generating super typerupper to handle the task :smile:


#10

That’ll teach me not to have my full 8 hours of uninterrupted sleep again!

Pete.