Using the ‚Console‘ to talk to the Yún MCU from Python

Playing around with the Yún led me to the problem that I had a Sketch up and running on the MCU that could be controlled from the Arduino serial console. To move the commanding part to a python script all I had to do was to do this communication from the Linux side of the Yún-Bridge system.

To initialize the Bridge all you have to do is call the Bridge.begin(); function in the setup part of the sketch. After that we initialize the Console with Console.begin(). To stop the execution of further commands we can poll the Console to become ready.
void setup() {
// put your setup code here, to run once:
while (!Console) {
You can now use the print functions as usual:
  if(Console.available()) {
c =;
On the Linux side we have a python script that will conncet to the bridge server and do the same as the Arduino serial console.
import telnetlib, time

tn = telnetlib.Telnet("localhost", 6571)

while True:
print "w"
print tn.read_eager()

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

Du kommentierst mit Deinem Abmelden /  Ändern )

Google Foto

Du kommentierst mit Deinem Google-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Twitter-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Facebook-Konto. Abmelden /  Ändern )

Verbinde mit %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.