Having problems communicating with HC-06

So I have been using a HC-06 and PuTTY to control a rover from my computer.

Last week it was working fine, I could use my keyboard in the PuTTY terminal and the rover would move.

Now, with all the same settings, IT WONT WORK.

The light status indicator is showing that it has connected, but nothing happens when I try control it.

Ive tried using Arduino IDE and control it from there but it wont work. I think its something to do with my Bluetooth connection or settings in PuTTY. The strangest part is everything was fine and I haven't changed a thing. Could it be possible that the hardware is damaged?

Desperate for some help, I have no idea how to get it working.

This is the code

/****************
Toby LI@Aus Electronics Direct
info@auselectronicsdirect.com.au
2017.9.14
Copyright
****************/

#include <Wire.h>

/*
L289N Connection:
ENA = 5V
ENB = 5V
IN1 = 5
IN2 = 6
IN3 = 10
IN4 = 11

LCD1602
SCL = SCL
SDA = SDA

Servo
Signal = 9

  • = 5V
  • = GND

Ultrasonic sensor
Trig = 12
Echo = 13

IR control
Signal = 2
********************************************************/
/Motor Pin Definition
/
int MotorRight1 = 5; //IN1 PWM enabled
int MotorRight2 = 6; //IN2 PWM enabled
int MotorLeft1 = 10; //IN3 PWM enabled
int MotorLeft2 = 11; //IN4 PWM enabled
int counter = 0;

/Bluetooth Init**********************/
unsigned char Bluetooth_val;
void Bluetooth_Control()
{
while (Bluetooth_val != 'E') // as long as it is not exit then
{
if (Serial.available()) //这一句是用来判断串口是否接收到数据的标志位。
{
Bluetooth_val = Serial.read(); //读取(蓝牙)串口数据,并把值赋给val;
switch (Bluetooth_val)
{
case '8': advance(5); Serial.print("\n Car GO "); //UP
break;
case '2': back(2); Serial.print("\n Car back "); //back
break;
case '4': left(5); Serial.print("\n Car Left"); //Left
break;
case '6': right(5); Serial.print("\n Car Right "); //Right
break;
case '5': stopp(1); Serial.print("\n Car stop "); //stop
break;
default: stopp(1);
break;
}
}
}
stopp(1);
}
/Initializition /
void setup()
{
Serial.begin(9600);
pinMode(MotorRight1, OUTPUT); // 5 (PWM)
pinMode(MotorRight2, OUTPUT); // 6 (PWM)
pinMode(MotorLeft1, OUTPUT); // 10 (PWM)
pinMode(MotorLeft2, OUTPUT); // 11 (PWM)
}
//
********(Void)
void advance(int a) //Forward
{
digitalWrite(MotorRight1, LOW);
digitalWrite(MotorRight2, HIGH);
digitalWrite(MotorLeft1, LOW);
digitalWrite(MotorLeft2, HIGH);
delay(a * 100);
}
void right(int b) //right turn one wheel control
{
digitalWrite(MotorLeft1, LOW);
digitalWrite(MotorLeft2, HIGH);
digitalWrite(MotorRight1, LOW);
digitalWrite(MotorRight2, LOW);
delay(b * 100);
}
void left(int c) //Left turn one wheel control
{
digitalWrite(MotorRight1, LOW);
digitalWrite(MotorRight2, HIGH);
digitalWrite(MotorLeft1, LOW);
digitalWrite(MotorLeft2, LOW);
delay(c * 100);
}

void stopp(int f) //stop
{
digitalWrite(MotorRight1, LOW);
digitalWrite(MotorRight2, LOW);
digitalWrite(MotorLeft1, LOW);
digitalWrite(MotorLeft2, LOW);
delay(f * 100);
}
void back(int g) //Back
{
digitalWrite(MotorRight1, HIGH);
digitalWrite(MotorRight2, LOW);
digitalWrite(MotorLeft1, HIGH);
digitalWrite(MotorLeft2, LOW);;
delay(g * 100);
}
//******************************************************************************(LOOP)
void loop()
{
if (Serial.available()) //If bluetooth successfully receive data
{
Bluetooth_val = Serial.read();// start to read the first char
if (Bluetooth_val == 'w') Bluetooth_Control(); // if read in 'w' then start control
}
}

Well, I guess you can safely assume this isn't true, and there is nothing to actually confirm that the hardware is "damaged". I guess that will only come out when you tell us how much you have abused it. In the light of what you have said, the code doesn't warrant attention, and checking for something silly, like a change you think you haven't made but actually have, or perhaps a flat battery, would be more to the point.

1 Like

Yes I agree something may have changed, but I cant find what it is. The Bluetooth com lines haven't changed or any of the settings on PuTTY. Ive changed battery's and Arduino modules. I have screen shots of the settings because I need to document them as a process for my uni assignment, and they are all the same.

Cheers for the condescending tone by the way, your message was oh so helpful! A real pearl of wisdom...

Well, in the absence of better information from you, the above pearl is about the best you will ever get. You will be amazed by what people can't see, but at least you now concede that you actually have changed something- the battery. In your first post, you didn't even bother to tell us you were using a battery, I just guessed it. Please don't tell us it's a 9v PP3..... If it is, and that is all you've got at the moment, you might try disconnecting all the motor stuff and then engage the serial monitor to see if there is any traffic from Bluetooth.