Hi,
I have a problem with my HC-05 not appearing in scan results.
(I'm using an Arduino UNO R3 + motor shield + 2 DC Motors + 9V Battery + HC-05)
I've been trying to make my Robot move using the Serial monitor using Bluetooth terminal app over Bluetooth using the HC-05 Module, So I've tried every single code, solution there is and the best i got was Ok when i send AT in AT mode on the IDE on PC, but with other commands like AT+NAME, nothing comes up even when i changed the baud rate and even tried multiple codes from different sources.
It doesn't appear on scan no matter what i do (I'm using an Android phone and i also tried scanning with pc) but still nothing appears.
This is the code of the robot I'm trying to control using the module:
#include <AFMotor.h>
//creates two objects to control two terminals on the motor shield
AF_DCMotor motor1(2);
AF_DCMotor motor2(1);
char command;
void setup()
{
Serial.begin(9600); //Set the baud rate to your Bluetooth module.
}
void loop(){
if(Serial.available() > 0){
command = Serial.read();
Stop(); //initialize with motors stopped
//Change pin mode only if new command is different from previous.
//Serial.println(command);
switch(command){
case 'F':
forward();
break;
case 'B':
back();
break;
case 'L':
left();
break;
case 'R':
right();
break;
default:
Stop();
break;
}
}
}
void forward()
{
motor1.setSpeed(220); //Define maximum velocity
motor1.run(BACKWARD); //rotate the motor clockwise
motor2.setSpeed(220); //Define maximum velocity
motor2.run(FORWARD); //rotate the motor clockwise
}
void back()
{
motor1.setSpeed(220);
motor1.run(FORWARD); //rotate the motor counterclockwise
motor2.setSpeed(220);
motor2.run(BACKWARD); //rotate the motor counterclockwise
}
void left()
{
motor1.setSpeed(220); //Define maximum velocity
motor1.run(FORWARD); //rotate the motor clockwise
motor2.setSpeed(100);
motor2.run(FORWARD); //turn motor2 off
}
void right()
{
motor1.setSpeed(100);
motor1.run(FORWARD); //turn motor1 off
motor2.setSpeed(220); //Define maximum velocity
motor2.run(FORWARD); //rotate the motor clockwise
}
void Stop()
{
motor1.setSpeed(0);
motor2.run(RELEASE); //turn motor1 off
motor2.setSpeed(0);
motor2.run(RELEASE); //turn motor2 off
}
Perhaps it's Faulty or maybe i fried the piece because i'm not using a voltage divider.
Thanks, in advance!.