5
5
Receives from software serial, sends to hardware serial.
6
6
7
7
The circuit:
8
- * RX is digital pin 2 (connect to TX of other device)
9
- * TX is digital pin 3 (connect to RX of other device)
8
+ * RX is digital pin 10 (connect to TX of other device)
9
+ * TX is digital pin 11 (connect to RX of other device)
10
+
11
+ Note:
12
+ Not all pins on the Mega and Mega 2560 support change interrupts,
13
+ so only the following can be used for RX:
14
+ 10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69
15
+
16
+ Not all pins on the Leonardo support change interrupts,
17
+ so only the following can be used for RX:
18
+ 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).
10
19
11
20
created back in the mists of time
12
- modified 9 Apr 2012
21
+ modified 25 May 2012
13
22
by Tom Igoe
14
23
based on Mikal Hart's example
15
24
18
27
*/
19
28
#include < SoftwareSerial.h>
20
29
21
- SoftwareSerial mySerial (2 , 3 ); // RX, TX
30
+ SoftwareSerial mySerial (10 , 11 ); // RX, TX
22
31
23
32
void setup ()
24
33
{
25
- // Open serial communications and wait for port to open:
34
+ // Open serial communications and wait for port to open:
26
35
Serial.begin (57600 );
27
- while (!Serial) {
36
+ while (!Serial) {
28
37
; // wait for serial port to connect. Needed for Leonardo only
29
38
}
30
39
31
-
40
+
32
41
Serial.println (" Goodnight moon!" );
33
42
34
43
// set the data rate for the SoftwareSerial port
@@ -43,3 +52,4 @@ void loop() // run over and over
43
52
if (Serial.available ())
44
53
mySerial.write (Serial.read ());
45
54
}
55
+
0 commit comments