root / arduino-1.0 / libraries / SoftwareSerial / examples / SoftwareSerialExample / SoftwareSerialExample.ino @ 58d82c77
History | View | Annotate | Download (415 Bytes)
1 | 58d82c77 | Tom Mullins | #include <SoftwareSerial.h> |
---|---|---|---|
2 | |||
3 | SoftwareSerial mySerial(2, 3); |
||
4 | |||
5 | void setup() |
||
6 | { |
||
7 | Serial.begin(57600); |
||
8 | Serial.println("Goodnight moon!"); |
||
9 | |||
10 | // set the data rate for the SoftwareSerial port |
||
11 | mySerial.begin(4800); |
||
12 | mySerial.println("Hello, world?"); |
||
13 | } |
||
14 | |||
15 | void loop() // run over and over |
||
16 | { |
||
17 | if (mySerial.available()) |
||
18 | Serial.write(mySerial.read()); |
||
19 | if (Serial.available()) |
||
20 | mySerial.write(Serial.read()); |
||
21 | } |