Add debug nodes to all outputs of the exec node, set them to Output Complete Message and check all properties of the outputs. There will probably be a helpful error message there.
Have you specified the full path to the executable file?
You've not checked in the flow file so we have no idea how you've configured the exec node.
Also you probably want to swap the dashboard start button for a inject node to get started and set the debug node to whole message not just payload to see more.
You should also check the Node-RED logs for more error messages.
As it is there isn't really anything we can help with so far.
And I assume you have tested running the compiles c program from the command line first?
The code when complied and run with a full path works just fine on my Ubuntu box with NR 4.1.0
Please don't be offended by the question, but your exec node is trying to run the compiled executable, not the C source code? Edit: I think that would give rc -13
Does it make a difference if you specify the full pathname of the executable eg /home/pedro/.node-red/bin/gen_percent (or wherever the file is)?
One cause of rc -2 is that the OS cannot find the file to execute it.
I will try the an inject node but I actually want have the code started by a user hitting a button. I think I have tried several forms of the path. I will try to hard code the full path again. That should be ok since the application is an embedded system. I don't really need relative path names.
I will also change the debug node to whole messages.
I was about to give up on this but since you guys are so helpful, I will keep trying.
@jbudd I'm not interested in the C code, I have that, I want to see the Node-RED flow so I can actually see how the exec node is configured (e.g. is the full path to the executable provided)
OK, thanks again for the attention to my problem. I have now committed flows.json to the repo. I also got the got the flow to run with the exec node in spawn mode. The trick was to use an absolute path to the compiled C command.
My purpose was to use the exec code in spawn mode so that it could drive a progress bar during flash memory programming stages. In addition to the absolute path, I needed to put a fflush(stdout) command after each printf of the C code. I also needed to use a change block to convert the string to a number. All these changes were the result of suggestions on this forum.
Thanks for all the support and thanks for node-red itself. I do embedded design involving FPGAs and I need a way to create web UIs without being a web developer. Node-Red is really working out for me.