Help with i2c lcd node


#1

Hi,
I have been trying ti display data to lcd using the node-red-contrib-lcd20x4-i2c node. It seems to auto detect the i2c address and the screen initialise.
I am struggling to try to display something by using an inject node with change node trying to change the payload to msg.payload.msgs, but got all confused.
Would appreciate a simple example to display "hello world"
Thanks

=================
This is all the description I can find:
This node will accept an object msg.payload.msgs. If the object passed does not contain 4 lines, the difference is filled with blank lines.

Line data structure:
msg must be a string.
If msg is more than 20 characters the node will handle scrolling.
pos (position) is optional and must be a number with any value between 1-20. This value is used for offsetting text, but you can also insert spaces in to msg instead of supplying pos.
If pos is not supplied it will default to 1.
center is optional and must be a boolean value passed as a string
If pos and center are both set, center will override pos.

If there is an error it will be logged to Node-RED and display an error on the LCD screen.

Object format:

msg.payload = {
msgs: [
{
msg: "string",
pos: number,
center: "boolean"
},
{
msg: "string",
pos: number,
center: "boolean"
},
{
msg: "string",
pos: number,
center: "boolean"
},
{
msg: "string",
pos: number,
center: "boolean"
}
]
};


#2

Try this out and see if it does anything
(Connect the output of the inject node to your LCD node)

[{"id":"abf6c8da.45ec38","type":"inject","z":"ad22efea.cbfb2","name":"","topic":"","payload":" { \"msgs\": [ { \"msg\": \"Hello World\" }]}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":270,"y":200,"wires":[["8128fb15.752488"]]},{"id":"8128fb15.752488","type":"debug","z":"ad22efea.cbfb2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":480,"y":200,"wires":[]}]

#3

Hi @cymplecy,
Thanks for that, it works! I tried all sorts of combinations for hrs and had even tried :
{msgs:[{"msg":"hello world"}]} in a change node before but had an error, obviously msgs needs to be "msgs".

Great this forum, and kudos to the gurus. Just make learning so much easier and quicker.

So much to learn...

Cheers,

Ken