Console Read

This example for the Arduino Yún reads data coming from Bridge using and stores it in a string.

To see the Console, pick your Yún's name and IP address in the Port menu then open the Port Monitor. You can also see it by opening a terminal window and typing: ssh root@ yourYunsName.local 'telnet localhost 6571' then pressing enter. When prompted for the password, enter it.

When running this example, make sure your computer is on the same network as the Yún.

Hardware Required

  • Arduino Yún
  • computer and Yún on the same wireless network


There is no circuit for this example.

image developed using Fritzing. For more circuit examples, see the Fritzing project page


Include the Console library, which inherits from Bridge.
#include <Console.h>

Create a string to hold the information from the Bridge
String name;

In setup() initialize the Bridge and Console. Wait for a Console connection, then ask for some information :

void setup() {

  while (!Console);

  Console.println("Hi, what's your name?");

In loop(), check to see if there are bytes in the Console buffer. If there's something available, read the the oldest character into a local variable.

void loop() {
  if (Console.available() > 0) {
    char c =;

If the character is a newline ("\n"), it is the last character in the incoming string. Print out the string to the Console, ask for more information, and clear the string.

if (c == '\n') {
      Console.print("Hi ");
      Console.println("! Nice to meet you!");
      Console.println("Hi, what's your name?");
      name = "";

If the character in the buffer is not a newline, add it to the end of the string.

else {     
      name += c;

The complete sketch is below :

SORRY, There is an error at our code repository, please inform to

See Also

  • Bridge Library - Your reference to the Bridge Library
  • Bridge – Simple REST style calls to access analog and digital pins
  • Consolle Ascii Table – A complete ASCII table printed to the Console
  • Console Pixel – Turn an LED on and off through the Console
  • Data Logger - Log data from three analog sensors to an SD card.
  • File Write - How to write file into the Yún filesystem.
  • Http Client - A basic HTTP client that connects to the internet and downloads content.
  • Mailbox Read Message - How to read the messages queue, called Mailbox, using the Bridge library.
  • Process - How to run linux processes using an Arduino Yún.
  • Shell Commands - How to run linux shell commands using an Arduino Yún.
  • Temperature Web Panel - How to serve data from an analog input via the Arduino Yún's built-in webserver.
  • Time check - Gets the time from Linux via Bridge then parses out hours, minutes and seconds.
  • WiFi Status - Prints information about the status of your wifi connection.
  • Serial Terminal - Use the Yún's 32U4 processor as a serial terminal for the Linux side on the Yún.

Last revision 2015/08/11 by SM