New Omni Rover 2.0

Need help with Omni Rover Christmas gift. We have the omni rover assembled (with the exception of the wheels because the hubs do not fit into the wheels and we are missing the screws); however, we are still trying to get it working without the wheels. We copied the omni_wasd_keyboard_control sample code and downloaded it to the board (at least we think we did because it said download complete). However, the board does not respond to any of the keys. We see some LEDs blink (a red one that turns green when a key is pressed and an LED that is off comes on green when a key is pressed), but nothing happens with the motors. I’ve measured the voltage at the M1 and M2 connectors on the board and M1 and M2 on the motor shield thinking I should see a voltage when keys are pressed but nothing.

Please help…I’m in over my head. I have lots more questions but I’d like to see the board respond to the keyboard controls for now.
Thank You

Do you have a battery plugged into the robot, or are you just using USB? Although you can power the microcontroller and electronics from USB, you will need to also use a battery to power the motors.

If you are already using a battery, and the power switch is on, then we would recommend trying the following code. It is the same as the OMNI example, but includes some Serial.println(…) statements that will allow you to use the Arduino Serial Monitor at 115,200 to check for the debug messages.

/* To control the Rover, copy and paste the code below into the Arduino
 software. Ensure the motors are connected to the correct pins. The
 code does not factor in encoders at this time*/

//Front motors
int E1 = 10 ; //M1 Speed Control
int E2 = 11; //M2 Speed Control
int M1 = 12; //M1 Direction Control
int M2 = 13; //M2 Direction Control

//Rear motors
int E3 = 6; //M1 Speed Control
int E4 = 5; //M2 Speed Control
int M3 = 8; //M1 Direction Control
int M4 = 7; //M2 Direction Control

void setup(void)
{
  int i;
  for(i=3;i<=13;i++)
  pinMode(i, OUTPUT);
  Serial.begin(115200);
}

void loop(void)
{
  while (Serial.available() < 1) {} // Wait until a character is received
  char val = Serial.read();
  int leftspeed = 255; //255 is maximum speed
  int rightspeed = 255;
  switch(val) // Perform an action depending on the command
  {
    case 'w'://Move Forward
    case 'W':
      forward (leftspeed,rightspeed);
      break;
    case 's'://Move Backwards
    case 'S':
      reverse (leftspeed,rightspeed);
      break;
    case 'a'://Turn Left
    case 'A':
      left (leftspeed,rightspeed);
      break;
    case 'd'://Turn Right
    case 'D':
      right (leftspeed,rightspeed);
      break;
    case 'q'://rotate ccw
    case 'Q':
      ccw (leftspeed,rightspeed);
      break;
    case 'e'://rotate cw
    case 'E':
      cw (leftspeed,rightspeed);
      break;
    case 'z'://move at 45 degrees
    case 'Z':
      fortyfive (leftspeed,rightspeed);
      break;
    case 'x'://move at 135 degrees
    case 'X':
      onethirtyfive (leftspeed,rightspeed);
      break;
    // to move at 225 and 315, use the 45 degree and 135 degree
    // code but reverse motor direction.
    default:
      stop();
      break;
  }
}

void stop(void) //Stop
{
  digitalWrite(E1,LOW);
  digitalWrite(E2,LOW);
  digitalWrite(E3,LOW);
  digitalWrite(E4,LOW);
  Serial.println("Stop");
}

void forward(char a,char b)
{
  analogWrite (E1,a);
  digitalWrite(M1,LOW);
  analogWrite (E2,b);
  digitalWrite(M2,HIGH);
  analogWrite (E3,a);
  digitalWrite(M3,LOW);
  analogWrite (E4,b);
  digitalWrite(M4,HIGH);
  Serial.println("Move Forward");
}

void reverse (char a,char b)
{
  analogWrite (E1,a);
  digitalWrite(M1,HIGH);
  analogWrite (E2,b);
  digitalWrite(M2,LOW);
  analogWrite (E3,a);
  digitalWrite(M3,HIGH);
  analogWrite (E4,b);
  digitalWrite(M4,LOW);
  Serial.println("Move Reverse");
}

void ccw (char a,char b)
{
  analogWrite (E1,a);
  digitalWrite(M1,HIGH);
  analogWrite (E2,b);
  digitalWrite(M2,HIGH);
  analogWrite (E3,a);
  digitalWrite(M3,HIGH);
  analogWrite (E4,b);
  digitalWrite(M4,LOW);
  Serial.println("Rotate CCW");
}

void cw (char a,char b)
{
  analogWrite (E1,a);
  digitalWrite(M1,LOW);
  analogWrite (E2,b);
  digitalWrite(M2,LOW);
  analogWrite (E3,a);
  digitalWrite(M3,LOW);
  analogWrite (E4,b);
  digitalWrite(M4,HIGH);
  Serial.println("Rotate CW");
}

void left (char a,char b)
{
  analogWrite (E1,a);
  digitalWrite(M1,HIGH);
  analogWrite (E2,b);
  digitalWrite(M2,HIGH);
  analogWrite (E3,a);
  digitalWrite(M3,LOW);
  analogWrite (E4,b);
  digitalWrite(M4,LOW);
  Serial.println("Move Left");
}

void right (char a,char b)
{
  analogWrite (E1,a);
  digitalWrite(M1,LOW);
  analogWrite (E2,b);
  digitalWrite(M2,LOW);
  analogWrite (E3,a);
  digitalWrite(M3,HIGH);
  analogWrite (E4,b);
  digitalWrite(M4,HIGH);
  Serial.println("Move Right");
}

void fortyfive (char a,char b)
{
  analogWrite (E1,a);
  digitalWrite(M1,LOW);
  analogWrite (E3,a);
  digitalWrite(M3,LOW);
  Serial.println("Move at 45 degrees");
}

void onethirtyfive (char a,char b)
{
  analogWrite (E2,b);
  digitalWrite(M2,HIGH);
  analogWrite (E4,b);
  digitalWrite(M4,HIGH);
  Serial.println("Move at 135 degrees");
}