Run Arduino Yún sketches via WiFi or Ethernet

The Arduino IDE traditionally used a USB connection to communicate between your computer and your board – until the Yún came along and made it possible to run sketches over a network, using either WiFi or Ethernet.

Since communicating over a network is very different than over USB, Arduino has introduced the new Console class to provide capabilities similar to those of the Serial class for running sketches over a network.

All of our Yún examples are written using Serial. They assume you're using a USB cable and have selected something like "/dev/tty.usbmodem241" on a Mac, "/dev/ttyUSB0" on Linux, or "COM4" on Windows in the Arduino IDE's Tools > Port menu. Thankfully, it's simple to convert our examples to use Console.

Convert your sketch to use Console

If you are using a network connection to communicate with your Yún, follow these two steps to convert from Serial to Console.

1Change the setup() method at the top of the sketch so that it looks like the snippet below.

void setup() {

2Replace every occurrence of the word "Serial" with the word "Console". For example, the line of code below:

Serial.println("All work and no play makes Jack a dull boy");
would be changed to this:
Console.println("All work and no play makes Jack a dull boy");

Ready To Run

After making these changes, you should be able to run your sketch over a network and see the output in the Arduino IDE's Serial Monitor window. Enjoy!

Need Help?

We're always happy to help. Just email us at, and we'll answer your questions.