Run a Processing sketch from Node-RED

Hello,

I’d like to see if anyone can help me run a specific Processing sketch through a Node-RED user interface. I’m building a connected desk lamp and would like to be able to change its light patterns from my phone.

I can’t use GPIO pins since designating a specific sketch requires more than a high/low output… what I think I need is some way to specify a string value which can be read into the Pi.

So I thought I could use an exec node to not only pass the string, but to also run the program at the same time.

The above image shows a bash file that I created later on, but originally, I put the following command in a bash file and tried to run it:

processing-java --sketch=/home/pi/Digital-lava-lamp/StartupArraySweep --run

The command works perfectly in the Pi’s terminal but when I try to execute it through Node-RED I get the following error.

I’ve tried to work around this a number of ways, but the same error occurs each time. Here’s everything that I’ve tried so far.

  • Running the above os.system command as is
  • Adding the above command to a bash file, then running the bash file
  • Adding the above command to a Python script, and calling it using os.system
  • Checking the msg.payload box in exec node
  • Unchecking the msg.payload box in exec node

So does anybody have any suggestions on what I should try next?? I can’t decipher the error to be able to fix it. If anyone can explain what’s wrong here, or maybe an alternate way to accomplish my goal, I’d be very grateful. Thanks.

Were you able to resolve?

Possibly related to your problem: