0

I have my HM-10 connected to my Arduino UNO and I'm trying AT commands. I keep getting � no matter what command I send. I am new to Arduino and have used http://www.blueluminance.com/HM-10-as-iBeacon.pdf guide for setting up the chip. Here is the code I'm using for the board

#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());
}
4

1 回答 1

0

切换mySerial.write(Serial.read());mySerial.println(Serial.read());

Serial.write 不转换数据,而 Serial.print 转换为字符。如果这有效,可能切换Serial.write到相同的。

于 2016-01-22T02:27:14.533 回答