execute Python Script without Bridge class


Is there any way to execute a Python script (or in general any Linux shell command) from the Arduino Sketch but without using the Bridge library?

Open up Serial1 at the right baud rate (not sure what it is, look at the Bridge library source). That will be talking to the Linux command line. You can then send whatever commands you want, and get the output back.

Be aware that you will get all of the Linux console output back, including any system log messages that can occur at any time. So be ready to get extraneous output mixed in with your Linx command output. You will also have to determine for yourself when the command is complete. You will also have to deal with getting the command prompt sent to you between commands. Also, when Linux boots, you will get LOTS of boot message output for the first minute or so, and before the first time you send a command after Linux boots, you need to send a carriage return to activate the command line, and this will cause another screenful of output as it sends the sighn-on banner.

Make sure your sketch code can deal with all of this, as well as any other unexpected output.

Is there a reason you don't want to use the Bridge library? It takes care of all of this for you and makes it very easy.

Thanks for your reply.

Essentially I was just curious but also because I'd like to write a code that runs both on the Yun and the new Tian which does not implement the Bridge library.

I only have the SerialUSB to communicate with the two processors but it seems too tricky to find a solution for my problem