Receiving strange characters HC06

Hi people!

I'm building a project using HC 06 bluetooth module. I already got a way to connect to module without trouble, but when i use my Android app (Bluetooth RC Controller from Playstore) to controll a RC car, i get some strange characters like "!, :, #, $, %, &, (, )" everytime when i press any application button.

Code:

#include <Servo.h>
#include <SoftwareSerial.h>
SoftwareSerial HC06(0, 1);
Servo myS;
int d = 1000;
//                 [0][1]
const byte me[2] = {7, 8}; //Left Motor
const byte md[2] = {5, 6}; //Right Motor
char cmd;

void setup() {
  myS.attach(9);
  myS.write(90);
  Serial.begin(9600);
  Serial.println("Serial ready.");
  HC06.begin(9600);
  Serial.println("Bluetooth ready.");
  pinMode(me[0], OUTPUT);
  pinMode(me[1], OUTPUT);
  pinMode(md[0], OUTPUT);
  pinMode(md[1], OUTPUT);
  }

void loop() {
  //stores bluetooth buffer to cmd variable
  while(HC06.available() > 0) {
    cmd = Serial.available();
    Serial.print("Command: ");
    Serial.println(cmd);
    
  }
}

Serial Monitor printscreen: Imgur: The magic of the Internet

Someone can help me please?

PS: after often pressing the application button, I get only characters like '?' and stops there.

I already solved the problem. Instead use: cmd = HC06.read();, i used cmd = HC06.available();.

I was so stupid :slightly_frowning_face:

Please change your message subject text to include [SOLVED] so people will know. Thanks.

hitmain123:
I was so stupid :slightly_frowning_face:

Perhaps more than you think. There is something not right here, and I submit your real problem is that you are using software serial on the hardware serial pins. Perhaps you are not using a common Arduino.