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.
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.
Guys I had the same time wasted when the first time I configured it.. so feel half happy, it's a common problem with this module.
It is just because the author haven't posted an adeguate example to clear it. Honestly I don't like when this happens, and unfortunately it happens quite often on Github..add an example like the following one is nothing, very easy, and saves hours of time and bad words ((
You need to buid a function which returns a msg.payload with the object msgs,
for example:
var yes-I-want-to-write-LCD=true;
var external-string="fourth line start at 1 and not centered";
if (yes-I-want-to-write-LCD===true) {msg={payload:{msgs: [{msg: "text in first line", pos: 1, center: false},{msg: "second line centered", pos: 1, center: true},{msg: "third line shifted by 2", pos: 3, center: false},{msg:external-string }]}}};
return msg;
Often, to original authors, things seem obvious that are not at all obvious to others coming along. The best action would be for you to amend the docs appropriately and submit a Pull Request. Documentation is often better to be written by the users than the author.