2 Replies Latest reply on Feb 12, 2016 8:27 AM by janunezc

    System Call to NodeJS from Arduino IDE not working any more

    janunezc

      This was working:

       

      system ( "node myprogram.js param1='Hello World' );

       

      It stopped to work, presumably after I upgraded firmware.

       

      I have also tried these:

       

      system ( "node /home/root/myprogram.js param1='Hello World' );

      system ( "/usr/bin/node myprogram.js param1='Hello World' );

       

      Any ideas?

        • 1. Re: System Call to NodeJS from Arduino IDE not working any more
          Intel_Peter

          Hello janunezc,

           

          What does you’re your script does? Can you share your code? I would like to test it myself.

          Also, which image are you using? And which version of the Arduino IDE are you using?

           

          Peter.

          • 2. Re: System Call to NodeJS from Arduino IDE not working any more
            janunezc

            I think I found the problem.

             

            My node script does a number of things, but the simple basic operation here was not working:

            var request = require('request');

            var fs = require('fs');

            console.log("TEST OK");

             

            When I removed lines 1 and 2 it would work.

             

            So it is not a problem of calling node.js.

             

            I tried installing request module globally (npm install request -g) but it doesnt fix it.

             

            Then I tried installing request module in the root folder (cd / ) + (npm install request)

             

            That made it work.

             

            So it seems that for some reason the node program remains under root folder context when I call it using a system call. My javascript is located in the /home/root/ folder; and I am calling it via system command in the Arduino Sketch

             

            system ("node /home/root/myscript.js");

             

            I am using the 159.devkit version.

             

            Thanks!

             

            --jn