johnty / node-red-contrib-i2clcd

node-red node for 1602 i2c-based backpacks
5 stars 8 forks source link

Feature Request: Expose LCD On and Off? #5

Open Humancell opened 5 years ago

Humancell commented 5 years ago

When I looked at the i2clcd npm module, it has the ability to turn on and off the LCD backlight.

I was curious if you might consider exposing this ability to node-red, maybe adding a few new keywords like "on" and "off"?

johnty commented 5 years ago

Did you try the functions directly? I couldn’t get the backlight functions to work, so I didn’t include it... but maybe it could be due to the specific backpacks I have.

On Sat, Jan 5, 2019 at 7:11 PM Scott C. Lemon notifications@github.com wrote:

When I looked at the i2clcd npm module, it has the ability to turn on and off the LCD backlight.

I was curious if you might consider exposing this ability to node-red, maybe adding a few new keywords like "on" and "off"?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/johnty/node-red-contrib-i2clcd/issues/5, or mute the thread https://github.com/notifications/unsubscribe-auth/AB1hfTHBgq5NkZlrGrQKie_BjD0l7msOks5vAT84gaJpZM4ZyLQ_ .

Humancell commented 5 years ago

I wrote the issue before looking at your code. It was too easy and straight forward ... and it works on my units!

I simply inserted the following lines, after your "init" if statement:

if (msg.topic.localeCompare("on") == 0) {
             lcd.on();
}

if (msg.topic.localeCompare("off") == 0) {
             lcd.off();
}

It works perfectly in Node-RED! I send the on/off commands and my backlight turns on and off!

johnty commented 5 years ago

Great! This was exactly what didn't work for me so I never added it - probably due to my hardware.

Feel free to submit a pull request and I'll merge it in. Thanks!

johnty commented 5 years ago

update: actually, looks like I was trying to use the setBacklight() function instead of just the on/off ones. the latter works fine. I'll push the updates.

Thanks again!