4WD Car 12V - Mega 2560 - Adafruit motor shield v2.3 - HC06

Hello,

i want to drive my car with the App “Bluetooth RC Controller”.

I connected the HC06 to mega 2560 (5V-5V gnd-gnd TX-RX18 rx-tx19)
Bluetooth Connection is working.

The Adafruit motor shield v2.3 is connected to the Mega 2560.

Powersupply (101,2V AA) → Motorshield (no VIN Jumper)
4
12V motors → M1 till M4

Powersupply (6*1,2V AA) → Mega 2560

Here is the sketch i used:

#include <Wire.h>
#include <Adafruit_MotorShield.h>

// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield();

// Select which ‘port’ M1, M2, M3 or M4.
Adafruit_DCMotor *M1 = AFMS.getMotor(1);
Adafruit_DCMotor *M2 = AFMS.getMotor(2);
Adafruit_DCMotor *M3 = AFMS.getMotor(3);
Adafruit_DCMotor *M4 = AFMS.getMotor(4);

const int BTState = 11;
int state;
long lastRead = 0; // Last read time from the bluetooth

void setup() {

AFMS.begin(); // create with the default frequency 1.6KHz
//AFMS.begin(1000); // OR with a different frequency, say 1KHz
// turn on motor

M1->setSpeed(255);
M2->setSpeed(255);
M3->setSpeed(255);
M4->setSpeed(255);
M1->run(RELEASE);
M2->run(RELEASE);
M3->run(RELEASE);
M4->run(RELEASE);

pinMode(BTState, INPUT);
// set up Serial library at 9600 bps

Serial.begin(9600);
Serial1.begin(38400);

}

void loop()
{

//Stop car when connection lost or bluetooth disconnected
if (digitalRead(BTState) == LOW) {
state = ‘S’;
}

//Save income data to variable ‘state’
if (Serial.available() > 0) {
state = Serial.read();
lastRead = millis(); // remember last read time
}

//If state is equal with letter ‘F’, car will go forward!
if (state == ‘F’) {

M1->run(FORWARD);
M2->run(FORWARD);
M3->run(FORWARD);
M4->run(FORWARD);
}

//If state is equal with letter ‘B’, car will go backward
else if (state == ‘B’) {

M1->run(BACKWARD);
M2->run(BACKWARD);
M3->run(BACKWARD);
M4->run(BACKWARD);
}

//If state is equal with letter ‘S’ for more than 1000ms, stop the car
else if ((state == ‘S’) && (millis() - lastRead > 1000)) {
M1->run(RELEASE);
M2->run(RELEASE);
M3->run(RELEASE);
M4->run(RELEASE);
}
}

Nothing works please help me.

Please use code tags when posting code, as described in the "How to use this forum" post.

Start small. Get the motor driver and motor working before adding anything else to the code, starting with the instructions from Adafruit.

DC Motor Test from adafruit every motor works correct.