Bluetooth control of DC motor

Hello, I’m trying to control a bluetooth motor using the Adafruit Bluefruit LE connect android app but struggling understanding the right way to write the program. I’m using an Arduino Uno with Adafruit Motorshield V2, Bluefruit LE SPI friend and this 12V DC motor ( for my hardware, with an adapter from the power outlet going to the motorshield with the voltage jumper in place.

The current program works with keystrokes put into the serial monitor (C-clockwise, S-stop, A-counterclockwise). I’ve tested with both the motor included in the starter Arduino kit and the motor I intend to use for the project, with the program working as intended for both. But I seem to be stumbling adapting it to work with bluetooth. I know that the code is definitely not the cleanest or most efficient but it works for what I need at the moment.

Here is the code for when I’m using keystrokes:

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

Adafruit_MotorShield AFMS = Adafruit_MotorShield(); 

Adafruit_DCMotor *myMotor = AFMS.getMotor(1);

int dir1PinA = 2;
int stopPin = 3;
int dir2PinA = 5;
int speedPinA = 6; // PWM control

void setup() { 
Serial.begin(9600); // baud rate
 Serial.println("Adafruit Motorshield v2 - DC Motor test!");

AFMS.begin();  // create with the default frequency 1.6KHz
pinMode(stopPin, OUTPUT);

  // turn on motor
void loop() {
// Initialize the Serial interface:
if (Serial.available() > 0) {
int inByte =;
int speed; // Local variable
switch (inByte) {
case 'c': // Clockwise rotation
analogWrite(speedPinA, 255);//Sets speed variable via PWM 
digitalWrite(dir1PinA, LOW);
digitalWrite(dir2PinA, HIGH);
digitalWrite(stopPin, LOW);
Serial.println("Clockwise rotation"); // Prints out “Motor 1 Forward” on the serial monitor
Serial.println("   "); // Creates a blank line printed on the serial monitor
case 's': // No rotation
analogWrite(speedPinA, 0); // 0 PWM (Speed)
digitalWrite(dir1PinA, LOW);
digitalWrite(dir2PinA, LOW);
digitalWrite(stopPin, HIGH);
Serial.println("No rotation");
Serial.println("   ");
case 'a': // Anti-clockwise rotation
analogWrite(speedPinA, 255); // Maximum PWM (speed)
digitalWrite(dir1PinA, HIGH);
digitalWrite(dir2PinA, LOW);
digitalWrite(stopPin, LOW);
Serial.println("Anti-clockwise rotation");
Serial.println("   ");

I’ve looked to see what other people have done but the programs don’t seem to work for me when I follow their steps. I’m just not sure if I don’t know how to specify the interface buttons on the phone instead of physical buttons or if it is something else.

I believe that I have the motorshield and bluetooth module soldered correctly because when I plug in the Uno I can see it on the app. When I run the controller example in the IDE and look at the serial monitor it starts printing gibberish as I press buttons on the controller part of the app, so it makes me second guess that I’ve done it correctly.

I’m hoping someone knows what I’m doing wrong. Thank you for any help you can provide.

I may be missing something but you seem to have shown us only the code that works and then you're asking us what's wrong with the code you haven't shown us. That's not helpful.

Have you tried a simple test sketch that just receives data from Bluetooth and prints it to monitor? Does that work? Do you get the data you're expecting?