Programming Question

Hello i want to make a robot but i have problem with the Arduino code.I use the materials

Arduino Motor Shield
http://www.ebay.com/itm/Motor-Drive-Expansion-Shield-Board-Module-L293D-For-Arduino-Duemilanove-Mega-UNO-/221605183415?pt=LH_DefaultDomain_0&hash=item3398b2bfb7

and Bluetooth HC-05.

the code is this:

#include <AFMotor.h> //import your motor shield library
AF_DCMotor motor1(1, MOTOR12_64KHZ); // set up motors.
AF_DCMotor motor2(2, MOTOR12_8KHZ);
AF_DCMotor motor3(3, MOTOR34_64KHZ);
AF_DCMotor motor4(4, MOTOR34_8KHZ);

void setup() {
   Serial.begin(9600); // begin serial communitication  
   //initial set up straight forward, no speed
   motor1.setSpeed(0); //set the speed of the motors, between 0-255
  motor2.setSpeed (0);
  motor3.setSpeed (0);
  motor4.setSpeed (0);
}

void loop() {
   
   // see if there's incoming serial data:
   if (Serial.available() > 0) {
       // read the oldest byte in the serial buffer:
       int incomingByte = Serial.read();
       
       // action depending on the instruction
       // as well as sending a confirmation back to the app
       switch (incomingByte) {
           case 'F':
               moveForward(255, true);
               Serial.println("Going forward");
               break;
           case 'R':
               turn(255, true);
               Serial.println("Turning right");
               break;
           case 'L':
               turn(255, false);
               Serial.println("Turning left");
               break;
           case 'B':
               moveForward(255, false);
               Serial.println("Going backwards");
               break;
           case 'S':
               moveForward(0, true);
               Serial.println("Stopping");
               break;
           default:
               // if nothing matches, do nothing
               break;
           
    }
     
  }
}

void moveForward(int speedBot, boolean forward) {
  //boolean forward controls motor direction
   if (forward) {
         motor1.setSpeed(255); //set the speed of the motors, between 0-255
    motor2.setSpeed (255);
    motor3.setSpeed (255);
    motor4.setSpeed (255);
       
  }
     else {
         motor1.setSpeed(255); //set the speed of the motors, between 0-255
    motor2.setSpeed (255);
    motor3.setSpeed (255);
    motor4.setSpeed (255);
       
  }
     motor1.setSpeed(255); //set the speed of the motors, between 0-255
  motor2.setSpeed (255);
  motor3.setSpeed (255);
  motor4.setSpeed (255);
}

void turn(int speedBot, boolean right) {
   //boolean right controls motor direction
     if (right) {
        motor1.setSpeed(255); //set the speed of the motors, between 0-255
    motor2.setSpeed (255);
    motor3.setSpeed (255);
    motor4.setSpeed (255);
       
  }
     else {
         motor1.setSpeed(255); //set the speed of the motors, between 0-255
    motor2.setSpeed (255);
    motor3.setSpeed (255);
    motor4.setSpeed (255);
       
  }
     motor1.setSpeed(255); //set the speed of the motors, between 0-255
  motor2.setSpeed (255);
  motor3.setSpeed (255);
  motor4.setSpeed (255);
}

I upload the sketch to the Arduino but nothing happens.Please help me, i need your help.Thanks in advnace

How did you test it? Did you open serial monitor? Did you send command (F, R, L etc)?

Please read the posting guidelines by Nick Gammon that appear at the top of this Forum, especially about using code tags for source code listings. Also, use Ctrl-T within the IDE to reformat your code before posting. It will help us help you.

Are you planning to use bluetooth on computer ?

No i didn't open the serial monitor.My plan is to controll the robot via smartphone(with the HC-05)

The robot wiring is

HC-05 Arduino Uno
RX--> TX
TX--> RX
Vcc--> 5v
GND--> GND

I upload the sketch to the Arduino but nothing happens

No i didn't open the serial monitor.My plan is to controll the robot via smartphone(with the HC-05)

With no serial input what do you expect to happen ?

UKHeliBob:
With no serial input what do you expect to happen ?

Could you help me please?

hmm, this would probably help you if you are following as the app from Android good play. get it. and I have done it before its really awesome

let me know what do you think ?

what kind of app are you planning to use what name ?

Could you help me please?

I would suggest that you start by getting things working using the Serial monitor before moving on to use Bluetooth. Run the program, open the Serial monitor, enter a command, press Return. What happens ?