I plug in BT rx to digital 11, BT tx to digital 10 and then 5v and ground from the HC-05 to the arduino. I then upload this code to the HC-05 that is set as a master.
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
void setup() {
Serial.begin(57600);
mySerial.begin(9600);
}
void loop() { // run over and over
Serial.println(mySerial.read());
delay(2000);
}
I then upload this code to the arduino with the HC-05 that is set as a slave:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10,11); // RX , TX
void setup() {
// put your setup code here, to run once:
mySerial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
mySerial.write("100");
delay(2000);
}
The issue is that I never receive "100" on the serial monitor, I only ever receive 49 and occasionally 48. When I changed it from "100" to "10" same thing happened. Any help would be appreciated.
1
.... 48 is the decimal ASCII value of string0
.... 104=h
, 101=e, 108=
l` etc. etc. ........... asciichart.com/ascii_decimal.html