Manual

22 | P a g e
char cmd[BlankPos[1] - BlankPos[0]];
for(int j = 0; j < (BlankPos[1] - BlankPos[0]) ; j++){
cmd[j] = BluetoothCmd[j + 1 + BlankPos[0]];
}
char Scmd[BlankPos[2] - BlankPos[1]];
for(int j = 0; j < (BlankPos[2] - BlankPos[1]) ; j++){
Scmd[j] = BluetoothCmd[j + 1 + BlankPos[1]];
}
Serial.print("cmd:\t");
Serial.print(atoi(cmd));
Serial.print("\t");
Serial.println(atoi(Scmd));
/*
*/
left = atoi(cmd);
right = atoi(Scmd);
if(left < 0) lr = 1;
else lr = 0;
if(right < 0) rr = 1;
else rr = 0;
}
}
else Serial.println("Invalid");
}
else Serial.flush();
}
void Motor_Control(int M1_DIR, int M1_EN, int M2_DIR, int M2_EN) //
control the motor rotation
{
////////// M1 ////////////////////////
if (M1_DIR == FORW) // M1 direction of the motor
digitalWrite (IN1, FORW); // set high, set the direction of the
forward
else
digitalWrite (IN1, BACK); // set low, set the direction of the back
if (M1_EN == 0) // M1 motor speed