Arduino

Reference Language | Libraries | Comparison | Changes

## Bridge Library for Arduino Yún

The Arduino Yún has two processors on board. One is an ATmega32U4 like on the Arduino Leonardo. The other is an Atheros 9331, running Linux and the OpenWRT wireless stack, which enables the board to connect to WiFi and Ethernet networks. It is possible to call programs or custom scripts on the Linux system through the Arduino to connect with various internet services.

The Bridge library simplifies communication between the ATmega32U4 and the AR9331. It inherits from Stream, and many of the methods should be familiar from Serial and other derivatives of Stream.

Bridge commands from the 32U4 are interpreted by Python on the AR9331. Its role is to execute programs on the GNU/Linux side when asked by Arduino, provide a shared storage space for sharing data like sensor readings between the Arduino and the Internet, and receiving commands from the Internet and passing them directly to the Arduino.

Bridge allows communication in both directions, acting as an interface to the the Linux command line. For a brief explanations of the terminal and executing commands on Linux see here.

To become familiar with the Yún, please see the getting started page and hardware page.

### Process

Process is used to launch processes on the Linux processor, and other things like shell scripts.

### Console

Console can be used to communicate with the network monitor in the Arduino IDE, through a shell. Functionally, it is very similar to Serial.

### FileIO

An interface to the Linux file system. Can be used to read/write files on the SD card

### HttpClient

Creates a HTTP client on Linux. Acts as a wrapper for common CURL commands, by extending Process.

### Mailbox

An asynchronous, sessionless interface for communicating between Linux and Arduino.

### YunClient

An Arduino based HTTP client, modeled after the EthernetClient class.

### YunServer

An Arduino based HTTP server, modeled after the EthernetServer class.

### Temboo

An interface to Temboo making it easy to connect to a large variety of online tools. See the Tembo documentation for more.

### Spacebrew

Spacebrew is "a simple way to connect interactive things to one another" that uses WebSockets to communicate. you can find more about Spacebrew through their online documentations.

### Examples

- Bridge: Access the pins of the board with a web browser.
- Console ASCII Table: Demonstrates printing various formats to the Console.
- Console Pixel: Control an LED through the Console.
- Console Read: Parse information from the Console and repeat it back.
- Datalogger: Store sensor information on a SD card.
- File Write Script: Demonstrates how to write and execute a shell script with Process.
- HTTP Client: Create a simple client that downloads a webpage and prints it to the serial monitor.
- Mailbox Read Messages: Send text messages to the Arduino processor using REST API through a browser.
- Process: Demonstrates how to use Process to run Linux commands.
- Shell Commands: Use Process to run shell commands.
- SpacebrewYun: See the Spacebrew documentation pages for more infos on the Examples listed in the Arduino Software.
- Temboo: See the Temboo documentation section for more infos on the Examples listed in the Arduino Software.
- Temperature Web Panel: Post sensor data on a webpage when requested by a browser.
- Time Check: Get the time from a network time server and print it to the serial monitor.
- WiFi Status: Runs a pre-configured script that reports back the strength of the current WiFi network.
- Yun Serial Terminal: Access the Linux Terminal through the serial monitor.

### Bridge Class

- Bridge Constructor

#### Functions

- begin()
- put()
- get()
- transfer()

### Process Class

- Process Constructor

#### Functions

- begin()
- addParameter()
- run()
- runAsynchronously()
- running()
- exitValue()
- close()
- runShellCommand()
- runShellCommandAsynchronously()
- available()
- read()
- write()
- peek()
- flush()

### Console Class

- Console Constructor

#### Functions

- begin()
- end()
- buffer()
- noBuffer()
- connected()
- available()
- read()
- write()
- peek()
- flush()

### FileIO Class

- FileIO

#### Functions

- FileSystem.begin()
- FileSystem.open()
- FileSystem.exists()
- FileSystem.mkdir()
- FileSystem.rmdir()
- FileSystem.remove()

- File

- close()
- rewindDirectory()
- openNextFile()
- seek()
- position()
- size()
- available()
- read()
- write()
- peek()
- flush()

### Mailbox Class

- Mailbox

#### Functions

- begin()
- end()
- readMessage()
- writeMessage()
- writeJSON()
- messageAvailable()

### HttpClient Class

- HttpClient

#### Functions

- get()
- getAsynchronously()
- ready()
- getResult()

### YunClient Class

- YunClient

#### Functions

- stop()
- connect()
- connected()
- available()
- read()
- write()
- peek()
- flush()

### YunServer Class

- YunServer

#### Functions

- begin()
- listenOnLocalhost()
- noListenOnLocalhost()
- write()

Reference Home

Corrections, suggestions, and new documentation should be posted to the Forum.

The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.

### Share

### This link has expired.
Please re-subscribe to our Newsletters.

### Subscribe to our Newsletters

Email

Please enter a valid email to subscribe

Arduino Newsletter
Arduino Store Newsletter

### Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy

###### Newsletter

- ©2015 Arduino
- Copyright Notice
- Contact us
- About us
- Careers