blob: 019babf7ec497c9bea10440f6e853dc1d9699e51 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
/*
Arduino Yun USB-to-Serial
Allows you to use the Yun's 32U4 processor as a
serial terminal for the linino processor
Upload this to an Arduino Yun via serial (not WiFi)
then open the serial monitor at 115200 to see the boot process
of the linino processor. You can also use the serial monitor
as a basic command line interface for the linino processor using
this sketch.
The circuit:
* Arduino Yun
created March 2013
by Massimo Banzi
This example code is in the public domain.
*/
<<<<<<< HEAD
long baud = 9600;
=======
long baud = 57600;
>>>>>>> 113e28d86188899e529ced3fed04e4116e3f5a88
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
int ledState = HIGH; // whether the LED is high or low
void setup() {
Serial.begin(baud); // open serial connection to Linino
Serial1.begin(baud); // open serial connection via USB-Serial
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
digitalWrite(led, ledState); // turn the LED on (HIGH is the voltage level)
}
void loop() {
// copy from virtual serial line to uart and vice versa
if (Serial.available()) { // got anything from USB-Serial?
char c = (char)Serial.read(); // read from USB-serial
Serial1.write(c); // write to Linino
ledState=!ledState; // invert LED state
digitalWrite(led, ledState); // toggle the LED
}
if (Serial1.available()) { // got anything from Linino?
char c = (char)Serial1.read(); // read from Linino
Serial.write(c); // write to USB-serial
}
}
|