Hi,
i try to connect a Uno(or Nano) to a HC-0x module using this sketch:
#include <SoftwareSerial.h>
SoftwareSerial BT(4,2); // RX de la Uno=pin AT4; TX de la Uno=pin 2
void setup(){
Serial.begin(9600);
Serial.println("Enter AT commands:");
BT.begin(9600);
}
void loop(){
if (BT.available())
Serial.write(BT.read());
if (Serial.available()){
String S = GetLine();
BT.println(S); // Si avec cela le bluetooth ne marche pas éliminer le saut de ligne, remplacer par BT.print(S);
Serial.println("---> " + S);
}
}
String GetLine(){
String S = "" ;
if (Serial.available()){
char c = Serial.read(); ;
while (c != '\n'){
S = S + c ;
delay(25) ;
c = Serial.read();
}
return( S ) ;
}
}
My Bluetooth module is this one:
I don't know if it is a HC-06 or a HC-08 (?) and the LED of the module flashes quickly, it does dot reply anything to the AT command...
Any solution ?
Thank you
