I successfully connected two Bluetooth modules, HC-05 and HC-06 like on this website:
I have an Arduino Nano that's the slave (HC-06) and an Arduino Mega that is the master (HC - 05) and there's is the code for both of them:
Reveiver - Master
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX | TX
String Data = "";
void setup() {
Serial.begin(9600);
mySerial.begin(9600);
}
void loop(){
while (mySerial.available()){
Serial.println(mySerial.read())
}
}
Sender - Slave
#include <SoftwareSerial.h>
SoftwareSerial BTserial(11, 10); // RX | TX
int c = 100;
void setup() {
Serial.begin(9600);
BTserial.begin(9600);
}
void loop(){
BTserial.println(c);
}
I tried
BTserial.write(c)
and doesn't work either, I receive numbers like 245,255. And when I change the data that I'm sending the numbers are different, so I know that they are communicating, I think it's a variable problem, but I tried a bunch of codes of the internet that supposedly work, but it doesn't seem to work for this case.