|
|
发表于 2015-9-30 13:42:14
|
显示全部楼层
/*
Mega multple serial test
Receives from the main serial port, sends to the others.
Receives from serial port 1, sends to the main serial (Serial 0).
This example works only on the Arduino Mega
The circuit:
* Any serial device attached to Serial port 1
* Serial monitor open on Serial port 0:
created 30 Dec. 2008
modified 20 May 2012
by Tom Igoe & Jed Roach
This example code is in the public domain.
*/
void setup() {
// initialize both serial ports:
Serial.begin(9600);
Serial3.begin(9600);
Serial.println("Hello!");
Serial.println("XBEE TEST RX!");
}
void loop() {
char Byte;
if(Serial.available()){
Byte=Serial.read();
Serial.print(Byte);
}
}------------------------------------------可以参考一下啊 |
|