2 days back I bought Arduino Yun. I'm able to flash Led on 13 pin. And I'm able to flash Led on Bread board connected to A0. I'm able to run linux commands.

Now I want control A0 pin using Linux/Python program. Is this possible? I read many documents. But I didn't find thing related to this.

How I can flash the LED using Linux programs?

  • 2
    Do you mean using the Linux side of the Yun or using a Linux computer? Jul 24, 2014 at 13:30
  • @bersch - please undo your edit which changed the subject of the question. Jul 24, 2014 at 15:47

5 Answers 5


There are several libraries which will do this for you. Basically, you should upload a special sketch onto the Arduino, which listens to the serial port, and performs the I/O that the Linux chip requests. Libraries which can do this are


I haven't used a Yun before, but here is my understanding.

The Yun is really 2 separate computers with a bidirectional serial port between them.

The output pins are on the Arduino side. If you want to control Arduino pins from the LINUX side, you need to come up with a simple command syntax for communicating between the 2 computers and write code on both sides that supports that command syntax.

Say the command is:


Where x is the pin number, and n is a value, 0 or 1. (for digital pins). For a PWM output pin you could use a command analogPin and values of n from 0 to 255:


On the LINUX side you'd just send that command through the serial port to the Arduino.

On the Arduino side, you'd write a loop that would wait for data to come into the serial port from the LINUX chip. If it gets data, it would read it into a buffer until it saw a semicolon.

Then it would break the data into separate lines using the semicolon as a delimiter, search for "digitalPin" or "analogPin", parse the data between the command and the semicolon for the values, and issue the digitalWrite or analogWrite command using those values.

  • how to send a command to from linux to arduino?
    – gangadhars
    Jul 25, 2014 at 6:28
  • I don't know the specifics. I bet there are example sketches on the Arduino site that show you how to send data between the two processors though. You would need to write code for both sides that defines a command syntax. The Yun's LINUX processor would send a series of bytes to the serial port and that represented a command to the Arduino processor. The Arduino processor would listen on it's serial port, and when it saw the command, it would use it to change the state of pin A0.
    – Duncan C
    Aug 24, 2014 at 1:47

Suggest starting with the the Mailbox examples in the Bridge library. Specifically the example http://www.arduino.cc/en/Tutorial/MailboxReadMessage Which shows how to transfer messages to the Arduino processor. It does discuss how to fire the curl process from the command line.


I am looking for the same thing. The only thing I have come up with is that you can use the Bridge Library and use curl on the Linux side to read or write the pins

  • 2
    Could you develop your answer further, e.g. with sample code that shows at least where to start?
    – jfpoilpret
    Jan 8, 2015 at 22:36
  • Bridge makes sense, but how would curl command help?
    – NoBugs
    Jul 12, 2015 at 4:10

The simpliest thing I've found, is using the command "lininoio start"

then you can use nodejs with https://github.com/ideino/ideino-linino-lib and you no need to worry with the sketch part anymore, just javascript :-)


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.