// read the oldest byte in the serial buffer:
incomingByte = Console.read();
// if it's a capital H (ASCII 72), turn on the LED:
if (incomingByte == 'H') {
digitalWrite(ledPin, HIGH);
}
// if it's an L (ASCII 76) turn off the LED:
if (incomingByte == 'L') {
digitalWrite(ledPin, LOW);
}
}
delay(100);
}
[Get Code]
To see the Console, select your Yún's name and IP address in the Port menu. The Yún will only
show up in the Ports menu if your computer is on the same LAN as the Yún. If your board is on
a different network, you won't see it in the Ports menu. Open the Port Monitor. You'll be
prompted for the Yún's password.
You can also see the Console by opening a terminal window and typing
ssh
root@yourYunsName.local 'telnet localhost 6571'
then pressing enter.
NB: If you are using Windows, you must install a terminal emulator.
PuTTY
is a reasonable
choice, but you will have to enter the two commands above separately.
Type 'H' to turn the LED on pin 13 on and type 'L' to turn it off.
Process
The Process commands allow you to run Linux processes on Linino through the Arduino.
In the following example, The Linino will connect to a server with
curl
, and download some
ASCII text. It prints the text a serial connection.
#include <Process.h>
void setup() {
// Initialize Bridge
Bridge.begin();
// Initialize Serial
Serial.begin(9600);
// Wait until a Serial Monitor is connected.
while (!Serial);
// run various example processes
runCurl();
}
void loop() {