MySensors Library & Examples  2.3.2-36-g2e00bf6
Echo.ino
1 #include <AltSoftSerial.h>
2 
3 // AltSoftSerial always uses these pins:
4 //
5 // Board Transmit Receive PWM Unusable
6 // ----- -------- ------- ------------
7 // Teensy 3.0 & 3.1 21 20 22
8 // Teensy 2.0 9 10 (none)
9 // Teensy++ 2.0 25 4 26, 27
10 // Arduino Uno 9 8 10
11 // Arduino Leonardo 5 13 (none)
12 // Arduino Mega 46 48 44, 45
13 // Wiring-S 5 6 4
14 // Sanguino 13 14 12
15 
16 // This example code is in the public domain.
17 
18 AltSoftSerial altSerial;
19 
20 void setup() {
21  Serial.begin(9600);
22  while (!Serial) ; // wait for Arduino Serial Monitor to open
23  Serial.println("AltSoftSerial Test Begin");
24  altSerial.begin(9600);
25  altSerial.println("Hello World");
26 }
27 
28 void loop() {
29  char c;
30 
31  if (Serial.available()) {
32  c = Serial.read();
33  altSerial.print(c);
34  }
35  if (altSerial.available()) {
36  c = altSerial.read();
37  Serial.print(c);
38  }
39 }
40 
AltSoftSerial::read
int read()
read
loop
void loop()
Main loop.
Definition: Echo.ino:28
AltSoftSerial
Definition: AltSoftSerial.h:43
AltSoftSerial::available
int available()
available
setup
void setup()
Called after node initialises but before main loop.
Definition: Echo.ino:20
AltSoftSerial::begin
static void begin(uint32_t baud)
Definition: AltSoftSerial.h:51