I am trying to use MATLAB's bluetooth object to connect to my HC-05 (connected to Arduino Uno by Serial) and send it strings ('1','2',etc). However, the issue is that when the data arrives it is in a strange format, and it seems like different inputs from MATLAB can give the same output in the HC05. Here is my problematic output: And here is the code I'm using:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
mySerial.begin(38400);
}
void loop() {
if (mySerial.available()) {
// read the incoming byte:
int c = mySerial.read();
Serial.println(c);
//Serial.println(c);
}
}
I've tried different baud rates for the software serial and switching the TX/RX wires. Also different println formats. The output just always seems odd no matter what format I put it in. Any idea what could be the problem?