Uno and Arduino Motor Shield and Adafruit bluefruit LE

Hi folks,

This is my second day ever of doing anything with Arduino. Please pardon my ignorance as it shows.

I can't make one of the motors on an Arduino Motor Shield do anything but start and stop.

My son is working on a remote controlled car for a school project. We wish to steer the car through speed control of the individual motors so we mounted an Arduino Motor Shield onto an Arduino Uno. We've hooked up an Adafruit Bluefruit LE to the motor shield. There are two little motors hooked up to the Motor Shield.

Altogether this should allow him to control the car through a bluetooth connection on his phone.

I cobbled together the sketch to control the car and am using a simple test app on an iPhone to send commands. Everything works perfectly except the Channel B motor. It will start and stop but will not change speed or direction. The Channel A motor works just fine. I suspect there's a conflict with one or more of the pins on the Bluefruit LE and the Motor Shield... MOSI and pin11 in particular look suspect to me. I've reassigned some pins for the bluefruit where I could (I understand that not all pins can be changed) but I don't know what else to try.

I know that you experts will want to see the code which follows but first some bullets:

The code:

#include <SPI.h>
#include "Adafruit_BLE_UART.h"

#define ADAFRUITBLE_REQ 7 //The Request pin is #7 on the Arduino board
#define ADAFRUITBLE_RDY 2 //Ready is 2
#define ADAFRUITBLE_RST 6 //Reset is 6
#define MOTOR_RDY 10 //The motor board Ready is pin 10
#define CHAN_A 3 //This is for motor A (on Channel A). It controls the motor's speed
#define CHAN_B 11 //This is the same but for Motor B on pin 11
#define BRAKE_A 9 //brakes for motor A and on pin 9
#define BRAKE_B 8 //Ditto but for Motor b and pin 8
#define DIR_A 12 //Tells motor A to go backward or forwards; "DIR" means "Direction"
#define DIR_B 13 //Same but for motor B
Adafruit_BLE_UART BTLEserial = Adafruit_BLE_UART(ADAFRUITBLE_REQ, ADAFRUITBLE_RDY, ADAFRUITBLE_RST);

String incomingCode="";
aci_evt_opcode_t laststatus = ACI_EVT_DISCONNECTED;

void setup(void)
{

Serial.begin(9600);
while(!Serial);

pinMode(ADAFRUITBLE_REQ,OUTPUT);

digitalWrite(ADAFRUITBLE_RDY, LOW);

BTLEserial.setDeviceName("LiamCar"); /* 7 characters max! */

pinMode(MOTOR_RDY,OUTPUT);
pinMode(BRAKE_A, OUTPUT); //Initiates Motor Channel A pin
pinMode(BRAKE_B, OUTPUT); //Initiates Brake Channel B pin
pinMode(DIR_A, OUTPUT);
pinMode(DIR_B, OUTPUT);
pinMode(CHAN_A, OUTPUT);
pinMode(CHAN_B, OUTPUT);

digitalWrite(DIR_A, LOW);
digitalWrite(DIR_B, LOW);
digitalWrite(BRAKE_A, HIGH);
digitalWrite(BRAKE_B, HIGH);
digitalWrite(MOTOR_RDY, HIGH);

analogWrite(CHAN_A, 0);
analogWrite(CHAN_B, 0);

BTLEserial.begin();
//SPI.begin();
}

void loop()
{
Serial.println("1");
// Tell the nRF8001 to do whatever it should be working on.
BTLEserial.pollACI();
Serial.println("2");
// Ask what is our current status
aci_evt_opcode_t status = BTLEserial.getState();
// If the status changed....
if (status != laststatus) {

// print it out!
if (status == ACI_EVT_DEVICE_STARTED) {
Serial.println(("* Advertising started"));
}
if (status == ACI_EVT_CONNECTED) {
Serial.println(("* Connected!"));
}
if (status == ACI_EVT_DISCONNECTED) {
Serial.println(("* Disconnected or advertising timed out"));
Allstop();
}
// OK set the last status change to this one
laststatus = status;
}
Serial.println("3");
if (status == ACI_EVT_CONNECTED) {
if (BTLEserial.available()) {
incomingCode="";
while (BTLEserial.available()) {
char c = BTLEserial.read();
incomingCode += String(c);
}
Serial.println(incomingCode);
setMotor(incomingCode);
}
}
}

void setMotor(String code) {

digitalWrite(ADAFRUITBLE_RDY, HIGH);
digitalWrite(MOTOR_RDY, LOW); //And we're telling the motor circuit to turn on.

String Motor= code.substring(0,1); //So to make this thing work, we're going to send from the phone commands in the form A123, B222, A-232, B-50, or A0 or B0.
//The first character indicates, you guessed it, the motor, so this code to the left finds the first character in the variable "code".
//It should always one of "a", "b", "A", or "B".
Motor.toUpperCase();
String Speed;
Speed= code.substring(1);

int selChan;
int selDir;
int selBrake;

if(Motor.equals("A")) {
selChan=CHAN_A;
selDir=DIR_A;
selBrake=BRAKE_A;
}
else if (Motor.equals("B"))//If it begins with a "B" then we set the selected variables for the B motor instead.
{
selChan=CHAN_B;
selDir=DIR_B;
selBrake=BRAKE_B;
}

Serial.println("selChan is: " + String(selChan));

digitalWrite(selBrake, LOW);
int speed=Speed.toInt();
Serial.println("MOTOR: " + Motor + " Speed: " + String(speed));//Print out more just for the heck of it.

if(speed<0)
{

if(Motor.equals("A"))
{
digitalWrite(selDir, HIGH);
}
else if(Motor.equals("B"))
{
digitalWrite(selDir, LOW);

}
}
else {
if(Motor.equals("A"))
{
digitalWrite(selDir, LOW);
}
else if(Motor.equals("B"))
{
digitalWrite(selDir, HIGH);
}
}

speed=abs(speed);

Serial.println("Current SelDir Sel " + String(selDir) + " highlow " + String(digitalRead(selDir)));
if(speed==0)
{
digitalWrite(selBrake, HIGH);
}
else
{
digitalWrite(selBrake, LOW); //Otherwise, no brakes.
}

Serial.println("sending to " + String(selChan) + " at speed " + String(speed));

analogWrite(selChan,speed);

digitalWrite(MOTOR_RDY, HIGH);
digitalWrite(ADAFRUITBLE_RDY, LOW);
}

void Allstop()
{
analogWrite(CHAN_A,0);
digitalWrite(BRAKE_A,HIGH);
analogWrite(CHAN_B,0);
digitalWrite(BRAKE_B,HIGH);
}

Did you ever figure this out?
I am trying to do the same thing with 4 motors