I have a script to bring a current time on LCD in Raspberry PI.
LCD is connected with Raspberry PI tested working fine.
I created a script name index.js inside ~/.node-red folder, and have installed LCD node module inside the same ~/.node-red folder using command : npm install lcd --save
cd ~/.node-red
pi@raspberrypi ~/.node-red $ sudo node index.js
When I tested inside using the command it brings the time on the LCD.
How to execute this index.js script in node-red node exec?
I have tried but does not work.
In inject node I entered string 1 as payload
In exec node I entered command: sudo /home/pi/.node-red/node index.js
I tried in many ways to execute but no luck,
please check the pictures and help me in this issue.
Thanks a lot in advance
In the exec config node
/usr/bin/sudo
node /home/pi/.node-red/index.js
You don't need to put your index.js in the .node-red directory but since it's there this should work.