hybridgroup / cylon-firmata

Cylon adaptor for the Firmata protocol
http://cylonjs.com
Other
45 stars 10 forks source link

Sending shell command to start Cylon node script from sketch #44

Closed rclai closed 8 years ago

rclai commented 8 years ago

I'm not sure where to ask this question..

I've been going through this guide: http://cylonjs.com/documentation/platforms/yun/

Regarding the step that tells you disable the bridge script. If you do that, does that mean that you can no longer send shell commands to Linux via the Firmata sketch like so:

Serial.begin(115200);
while (!Serial);
Bridge.begin();
Process shell;
shell.runShellCommand(".....");

I'm doing this to run the Node script that has Cylon in it.

Does the Node script need to be started inside the /etc/rc.local file?

edgarsilva commented 8 years ago

@rclai Well kind of, you are just not gonna be able to communicate through the sketch, but since you are gonna be running the script directly in the linux part of the YUN you could easily read whatever value from the Arduino inputs and run a corresponding command in the Cylon program you are running.

So instead of running shell.runShellCommand() when a button is pressed in the arduino, you would be checking that same button click in your Cylon program, in javascript, and you would run that shell script from node.js using JS instead of doing it from the firmata sketch.

edgarsilva commented 8 years ago

@rclai forgot to answer this:

I'm doing this to run the Node script that has Cylon in it.
Does the Node script need to be started inside the /etc/rc.local file?

Yes you are gonna need to setup your node.js program to start with a script. Remember that for this to work you need to be running the modified firmata sketch in the arduino, to be able to communicate through serial (which was connected to the bridge before) from the linux side to the arduino side.

rclai commented 8 years ago

Thanks for responding. I got everything set up and got a Cylon script working. I was just wondering if it was possible to get the node script running asap when the arduino turns on. Because on the Yun, my node script starts running after about 2 minutes.