Bluetooth Arduino UNO连接到HM-10返回� 听命
我把我的HM-10连接到我的Arduino UNO,我正在尝试指挥。我一直在� 不管我发出什么命令。我是Arduino的新手,并使用指南来设置芯片。这是我在黑板上使用的代码Bluetooth Arduino UNO连接到HM-10返回� 听命,bluetooth,arduino-uno,hm-10,Bluetooth,Arduino Uno,Hm 10,我把我的HM-10连接到我的Arduino UNO,我正在尝试指挥。我一直在� 不管我发出什么命令。我是Arduino的新手,并使用指南来设置芯片。这是我在黑板上使用的代码 #include <SoftwareSerial.h> SoftwareSerial mySerial(0, 1); // RX, TX void setup() { // Open serial communications and wait for port to open: Serial.beg
#include <SoftwareSerial.h>
SoftwareSerial mySerial(0, 1); // RX, TX
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
// wait for serial port to connect. Needed for Leonardo only
}
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());
}
切换mySerial.writeSerial.read;到mySerial.printlnSerial.read
Serial.write不转换数据,而Serial.print转换为字符。如果这样做有效,可能会将Serial.write切换到相同的位置