blob: bf852bf297dd9df2f3d0cbe0463564dda84ac14a (
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
|
/*
Software serial multiple serial test
Receives from the hardware serial, sends to software serial.
Receives from software serial, sends to hardware serial.
The circuit:
* RX is digital pin A0 (connect to TX of other device)
* TX is digital pin A1 (connect to RX of other device)
This example code is in the public domain.
*/
#include <SoftwareSerial.h>
SoftwareSerial mySerial(A0, A1); // RX, TX
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
while ( !Serial ) delay(10); // for nrf52840 with native usb
Serial.println("Goodnight moon!");
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
mySerial.println("Hello, world?");
}
void loop() // run over and over//
{
if (mySerial.available())
Serial.write(mySerial.read());
if (Serial.available())
mySerial.write(Serial.read());
}
|