Bluetooth module signal is not being picked up by phone app?

My projects bluetooth module is not read by the phone app used to control the project.
I have checked the
hardware connections they are all fine
the motorsheild library sketch uploaded to the arduino
.
I am not sure where I am going wrong???

The hardware connections are not fine, you just think they are.
You don't know what bluetooth module you are using.
Your code is a state secret.
Your motorshield is drawing too much power and everything is in a state of electrical collapse.
You don't know how to operate your phone, or even what sort of phone it is, and you don't even know what app you are trying to use on it.

Don't worry, some mindreader will eventually come along and sort this out.

bluetooth module is constantly flashing red which means it is working
module is the HC-06
I uploaded a sketch for the motorshield
the app is called “bluetooth arduino tank”
code used :

#include <AFMotor.h>

AF_DCMotor motor2(2, MOTOR12_64KHZ); // create motor #2, 64KHz pwm
AF_DCMotor motor1(1, MOTOR12_64KHZ);
int state = 0;

void setup() 
{
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Welcome: Forward = 1 Left = 2 Right = 3 Backwards = 4 Stop = 0");
  motor2.setSpeed(200);     // set the speed to 200
  motor1.setSpeed(200);     // set the speed to 200
}

void loop(){   //if some data is sent, read it and save it in the state variable

if(Serial.available() > 0)
  {
    state = Serial.read();
    Serial.print("I received: ");
    Serial.println(state);
    delay(10);</p>
if (state == '0') 
    {
      motor2.setSpeed(200);     // set the speed to 200/255
      motor1.setSpeed(200);     // set the speed to 200/255
      motor2.run(RELEASE);      // turn it on going forward
      motor1.run(RELEASE);      // turn it on going forward
      Serial.println("Stopped");
      delay(100);
      state = 0; 
    }
else if (state == '1')      // If 1 Forwards
    {
      motor2.run(RELEASE);      // turn it on going forward
      motor1.run(RELEASE);      // turn it on going forward
      motor2.setSpeed(200);     // set the speed to 200
      motor1.setSpeed(200);     // set the speed to 200
      motor2.run(FORWARD);      // turn it on going forward
      motor1.run(FORWARD);      // turn it on going forward
      Serial.println("Forward");
      delay(100);
      state = 0; 
    }
else if (state == '2')      // If 2 Turn Left
    { 
      motor2.run(RELEASE);      // turn it on going forward
      motor1.run(RELEASE);      // turn it on going forward  
      motor1.setSpeed(255);     // set the speed to 200/255
      motor1.run(FORWARD);
      //motor2.run(BACKWARD);      
      Serial.println("Left");
      delay(100);
      state = 0;     
    }
else if (state == '3') {    // If 3 Turn Right
      motor2.run(RELEASE);      // turn it on going forward
      motor1.run(RELEASE);      // turn it on going forward
      motor2.setSpeed(255);     // set the speed to 255
      motor2.run(FORWARD);      
      //motor1.run(BACKWARD);    
      Serial.println("Right");
      delay(100);
      state = 0;  
    }
else if (state == '4')       // If 4 Backwards
    {
      motor2.run(RELEASE);      // turn it on going forward
      motor1.run(RELEASE);      // turn it on going forward
      motor2.setSpeed(200);      // set the speed to 200
      motor1.setSpeed(200);      // set the speed to 200
      motor2.run(BACKWARD);      // Motor 2 backwards
      motor1.run(BACKWARD);      // Motor 1 backwards
      Serial.println("Backward");
      delay(100);
      state = 0;   
    }
else if (state == '5') 
    {
      motor2.run(RELEASE);      // turn it on going release
      motor1.run(RELEASE);      // turn it on going release
      motor2.setSpeed(255);     // set the speed to 255
      motor1.setSpeed(140);     // set the speed to 140
      motor2.run(FORWARD);      // Motor 2 forward
      motor1.run(FORWARD);      // Motor 1 forward
      Serial.println("Forward Right");
      delay(100);
      state = 0;   
     }
else if (state == '6') 
    {
      motor2.run(RELEASE);      // turn it on going release
      motor1.run(RELEASE);      // turn it on going release
      motor1.setSpeed(255);     // set the speed to 255
      motor2.setSpeed(140);     // set the speed to 140
      motor2.run(FORWARD);      // Motor 2 forward
      motor1.run(FORWARD);      // Motor 1 forward
      Serial.println("Forward Left");
      delay(100);
      state = 0;   
     }
else if (state == '7')       // If 4 Backwards
    {
      motor2.run(RELEASE);      // turn it on going forward
      motor1.run(RELEASE);      // turn it on going forward
      motor1.setSpeed(255);     // set the speed to 255
      motor2.setSpeed(140);     // set the speed to 140
      motor2.run(BACKWARD);      // Motor 2 backwards
      motor1.run(BACKWARD);      // Motor 1 backwards
      Serial.println("Backward Right");
      delay(100);
      state = 0;   
    }
else if (state == '8')       // If 4 Backwards
    {
      motor2.run(RELEASE);      // turn it on going forward
      motor1.run(RELEASE);      // turn it on going forward
      motor2.setSpeed(255);     // set the speed to 255
      motor1.setSpeed(140);     // set the speed to 140
      motor2.run(BACKWARD);      // Motor 2 backwards
      motor1.run(BACKWARD);      // Motor 1 backwards
      Serial.println("Backward Left");
      delay(100);
      state = 0;   
    }
else if (state >= '9')
    {
      Serial.println("Invalid");
      delay(100);
      state = 0; 
    }
  }
}

When the HC-06 is flashing red it means that it has power. You need to connect it to your phone. When it is connected it will be steady red.

Check out step 4 "Pairing Smartphone with Bluetooth module" of the instructable where you got the code.

I checked the instructable. The smartphone reads the bluetooth module and I paired it with the OH-06 and in the app I can see it but I still get a flashing red light and an error from the app saying unable to connect to bluetooth devicet?

robodoc99:
bluetooth module is constantly flashing red which means it is working

No it doesn't. It just means the power is on and it is ready to connect. When I said an option is that you don't know how to use your phone, I wasn't entirely kidding, and even when the the LED goes out, it doesn't mean Arduino is connected properly.

You might find the following background notes useful

http://homepages.ihug.com.au/~npyner/Arduino/GUIDE_2BT.pdf
http://homepages.ihug.com.au/~npyner/Arduino/BT_2_WAY.ino

There may yet be nothing wrong with code or wiring, you just haven't got the procedure.

BLUETOOTH OPERATION Now for the big bit. 1. Run your Bluetooth terminal programme. 2. Go to the settings and press the connect button. 3. The list of paired bluetooth connections should come up. 4. Select Bluetooth you want and, see the confirmation, and the LED go continuous, now exit

I am still getting a flashing LED and the android phone can not connect with the HC-06 module
I went thorough the instructions in
http://homepages.ihug.com.au/~npyner/Arduino/GUIDE_2BT.pdf

robodoc99:
*BLUETOOTH OPERATION Now for the big bit. 1. Run your Bluetooth terminal programme. *
I am still getting a flashing LED and the android phone can not connect with the HC-06 module

That is item 13. Have you been through item 10. ESTABLISHING BLUETOOTH CONNECTION? Note the last para.

I see I have stuffed up the numbering. I am not referring to the test code.

Understand the difference between pairing and connection, LED must be flashing 2Hz before you pair and before you connect.

Nick_Pyner:
That is item 13. Have you been through item 10. ESTABLISHING BLUETOOTH CONNECTION? Note the last para.

I see I have stuffed up the numbering. I am not referring to the test code.

Understand the difference between pairing and connection, LED must be flashing 2Hz before you pair and before you connect.

I paired the bluetooth with phone when it was flashing then went on app and connected the flashing stopped and LED was just on I tried controlling the robot but no movement even though the motorshield was turned on with the green LED so what could be the issue now??? Thanks !!!

You appear to have proven that connection Android<>Bluetooth is OK.

This does not prove the connection Bluetooth<>Arduino is OK. Check your wiring

It is also possible that the robot cannot be controlled because your code is not kosher, or there is insufficient power, and Bluetooth is entirely innocent. I can’t comment on the code, but insufficient power never surprises me. I can only suggest you read reply #5 again and act on it. At least that will prove your bluetooth is OK.

Nick_Pyner:
You appear to have proven that connection Android<>Bluetooth is OK.

This does not prove the connection Bluetooth<>Arduino is OK. Check your wiring

It is also possible that the robot cannot be controlled because your code is not kosher, or there is insufficient power, and Bluetooth is entirely innocent. I can’t comment on the code, but insufficient power never surprises me. I can only suggest you read reply #5 again and act on it. At least that will prove your bluetooth is OK.

To clarify is the motor code needed the one in motorshield excample library??
Which is what I have uploaded:

Adafruit Motor shield library
// copyright Adafruit Industries LLC, 2009
// this code is public domain, enjoy!

#include <AFMotor.h>
#include <Servo.h>

// DC motor on M2
AF_DCMotor motor(2);
// DC hobby servo
Servo servo1;
// Stepper motor on M3+M4 48 steps per revolution
AF_Stepper stepper(48, 2);

void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println(“Motor party!”);

// turn on servo
servo1.attach(9);

// turn on motor #2
motor.setSpeed(200);
motor.run(RELEASE);
}

int i;

// Test the DC motor, stepper and servo ALL AT ONCE!
void loop() {
motor.run(FORWARD);
for (i=0; i<255; i++) {
servo1.write(i);
motor.setSpeed(i);
stepper.step(1, FORWARD, INTERLEAVE);
delay(3);
}

for (i=255; i!=0; i–) {
servo1.write(i-255);
motor.setSpeed(i);
stepper.step(1, BACKWARD, INTERLEAVE);
delay(3);
}

motor.run(BACKWARD);
for (i=0; i<255; i++) {
servo1.write(i);
motor.setSpeed(i);
delay(3);
stepper.step(1, FORWARD, DOUBLE);
}

for (i=255; i!=0; i–) {
servo1.write(i-255);
motor.setSpeed(i);
stepper.step(1, BACKWARD, DOUBLE);
delay(3);
}
}

The code is meaningless to me, but I should have mentioned before that it would be a good idea to test it by feeding signals from serial monitor, thereby leaving bluetooth out of the game. If no result, read reply #9, again.

serial monitor works
power to arduino+motorshield+bluetooth module work
pairing between phone android and bluetooth module works
I tried two different apps and both give same error no movement???

robodoc99:
serial monitor works

I didn't ask if the serial monitor works, I suggested that you send/receive the appropriate signals from serial monitor instead of bluetooth. Does that work? If yes, you have a Bluetooth problem, read reply #5 again. If no, bluetooth is probably innocent.

power to arduino+motorshield+bluetooth module work

Good. I won't ask how you know that, but if you did it by feeding signal from serial monitor, then everything is fine except bluetooth comms.(?)

pairing between phone android and bluetooth module works

Read reply #9 again. And check the wiring - again.

I tried two different apps and both give same error no movement???

I guess there is no surprise there, particularly after the second one.

"1. Arduino>Bluetooth. This is done by programming, which may be as simple as Serial.begin(9600); Serial.println(“lahdedah”);"

I thought that bluetooth arduino connection doesn`t need a code??

Well, I'm not going to ask how else you would expect Arduino to communicate without any code, and I'll just put this down to a troll.

I should have clarified!! I already have a code uploaded what i meant is there a configuration needed to set up the HC-06 module first?

What happens if you just turn your loop into something simple like this. . .

        digitalWrite(motor1Pin1, HIGH);
        digitalWrite(motor1Pin2, LOW); 
        digitalWrite(motor2Pin1, LOW);
        digitalWrite(motor2Pin2, HIGH);

What happens if you just try to respond to states like this. . .

if (state == "w") {
   Serial.print("in state w");
}

Did the code you posted in post #10 make the motors run?

You're trying to debug everything at one. You need to isolate.

the code made the motors run when I tried it with serial monitor

robodoc99:
I should have clarified!! I already have a code uploaded what i meant is there a configuration needed to set up the HC-06 module first?

No.
Read the notes. All you should need is to ensure that the baud rate in the code matches that of the HC-06, usually 9600, and the wiring is correct. If the motor works when you send commands from serial monitor, you should be able to send the same commands from the phone. As I said, you can leave the serial monitor connected in order to see this. Indeed having it connected is a good idea in that it may save you from a power problem.