Hi,
I have tried to use the “SparkFun HM1X Bluetooth Arduino Library” to read the
HM12-T module name.
I got a problem is just can read some times, after that no data return.
My code for the test with the UNO Arduino board:
// Use Library Manager or download here:
https://github.com/sparkfun/SparkFun_HM … no_Library
#include <SparkFun_HM1X_Bluetooth_Arduino_Library.h>
#include <SoftwareSerial.h>
HM1X_BT bt;
//#define mySerial SerialUSB // Abstract serial monitor debug port
// BLE and EDR device names
String edrName = “MyEDR”;
String bleName = “MyBLE”;
SoftwareSerial mySerial(5, 6); // RX, TX
void setup() {
Serial.begin(115200);
mySerial.begin(9600);
if (bt.begin(Serial, 115200) == false) {
mySerial.println(F(“Failed to connect to the HM12-T.”));
while (1) ;
}
mySerial.println(“Ready to Bluetooth!”);
boolean resetRequired = false; // Reset is required on name change
readName();
}
void loop() {
readName();
delay(5000);
}
void readName(){
mySerial.println("EDR name is: " + bt.getEdrName());
mySerial.println("BLE name is: " + bt.getBleName());
mySerial.println("EDR address: " + bt.edrAddress());
mySerial.println("BLE address: " + bt.bleAddress());
mySerial.println(“”);
}
and just can get some time, after that no data return as attaching the picture.
can give me any idea about this problem ??
thanks,
Bac