The linux processor runs a Python script from which I would like to send an array of integers to the Yun microprocessor. How can I do that?

And then, how can I retrieve and then use this array in my Arduino Sketch?

3 Answers 3


Given that my Python script printed the following

[10, 20, 30, 40]

This is the sketch I used to retrieve the array

#include <Bridge.h>
#include <Process.h>

void setup()

void loop()
   Process proc;
   int i=0;
   size_t dim = 1;
   int* array = (int*)malloc(dim);

   Serial.print("Running process...");
   proc.runShellCommand("python /script.py");

   while (proc.available()){
     if((char)proc.read() != ']'){
        array[i] = proc.parseInt();
        array = (int*)realloc(array,dim);


The Yun makes communication between the microprocessor and the Linux side easy. On the Arduino side, use the Bridge library in your "processing script" to read (or write) Bridge values set by the python program running on the Linux side. From the linux side, the bridge looks like a web address and you set values by addressing a URL with a get or put url http request. You can also manipulate these values from another computer on the network as well if you like.

I have some Arduino Yun dataloggers that use the Linux side to communicate via wifi with an ftp server that serves several Yun dataloggers. The arduino script reads the sensors, creates the records, etc. You can also have the microprocessor side write files that are used by the linux side of the Yun.

I find the Yun's combination of Linux and the regular arduino in one package makes the overall system easier to program and to interface with the rest of the web.


Serial1 on the Arduino side is connected to a serial console on the Linux side.

So, you could use calls on the Arduino to run your Python script on the Linux side and then listen to the output of the script to come back though the serial port and part it.

Here is an example of a project where I used a Yun like this. The Arduino side interfaces to some temperature sensors, and then types commands into the Linux side over the serial connection to run CURL and report data to internet URLs.


I am going to warn you that this is very ugly. Then Yun itself is quite ugly too. There were so many problems that I ended up giving up on this platform completely.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.