Controlling a toy car using JY MCU and wasd control

Hello.

I’m completely new to Arduino and I’ve been trying to figure out how to control my toy car via Bluetooth command. The toy car has 2 motors with just power and ground cables, so I used an h-bridge (AIA, AIB, BIA, BIB) to control the direction of rotation.

I used the Bluetooth code to set up a connection between the JY MCU and my laptop (while TX was wired to pin 10 and RX to pin 11) and confirmed the connection with the Serial Monitor. Then I uploaded the StandardFirmata to Arduino Uno. Then I plugged in TX to pin RX and RX to pin TX. Since I use windows, I found a new device and connected using the pin I had set up.

At this point, how do I know that the Arduino and my laptop is connected via Bluetooth? When I click on the device in my laptop, it says “No available services or remote device connection failure.”

Anyhow, next, I uploaded my code to control the car, and then I opened up Processing to input commands to the car (this works perfectly when I use cables and control the car without the Bluetooth connection). However, Processing continuously tells me that either port 10 (port for the Bluetooth) is not found or busy.
I’m sorry if any of what I wrote makes no sense, but if someone could tell me how to fix this problem, I would really appreciate it!

#define ROBOT_NAME "RandomBot"
#define BLUETOOTH_SPEED 57600

#include <SoftwareSerial.h>

// Swap RX/TX connections on bluetooth chip
//   Pin 10 --> Bluetooth TX
//   Pin 11 --> Bluetooth RX
SoftwareSerial mySerial(10, 11); // RX, TX


/*
  The posible baudrates are:
    AT+BAUD1-------1200
    AT+BAUD2-------2400
    AT+BAUD3-------4800
    AT+BAUD4-------9600 - Default for hc-06
    AT+BAUD5------19200
    AT+BAUD6------38400
    AT+BAUD7------57600 - Johnny-five speed
    AT+BAUD8-----115200
    AT+BAUD9-----230400
    AT+BAUDA-----460800
    AT+BAUDB-----921600
    AT+BAUDC----1382400
*/


void setup()
{
  Serial.begin(57600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
  Serial.println("Starting config");
  mySerial.begin(BLUETOOTH_SPEED);
  delay(1000);

  // Should respond with OK
  mySerial.print("AT");
  waitForResponse();

  // Should respond with its version
  mySerial.print("AT+VERSION");
  waitForResponse();

  // Set pin to 1234
  mySerial.print("AT+PIN1234");
  waitForResponse();

  // Set the name to ROBOT_NAME
  mySerial.print("AT+NAME");
  mySerial.print(ROBOT_NAME);
  waitForResponse();

  // Set baudrate to 57600
  mySerial.print("AT+BAUD7");
  waitForResponse();

  Serial.println("Done!");
}

void waitForResponse() {
    delay(1000);
    while (mySerial.available()) {
      Serial.write(mySerial.read());
    }
    Serial.write("\n");
}

void loop() {}
#define COMMAND_LEFT 'a'
#define COMMAND_RIGHT 'd'
#define COMMAND_FORWARD 'w'
#define COMMAND_BACK 's'
#define COMMAND_STOP ' '

int wait = 50;
const int AIA = 9;  // (pwm) pin 9 connected to pin A-IA 
const int AIB = 5;  // (pwm) pin 5 connected to pin A-IB 
const int BIA = 3; // (pwm) pin 10 connected to pin B-IA  
const int BIB = 6;  // (pwm) pin 6 connected to pin B-IB 

byte speed = 100;  // change this (0-255) to control the speed of the motors 

void setup() {
  Serial.begin(9600);
  pinMode(AIA, OUTPUT); // set pins to output
  pinMode(AIB, OUTPUT);
  pinMode(BIA, OUTPUT);
  pinMode(BIB, OUTPUT);
}

void loop() {
int msg = Serial.read();

if (msg == 1){
      analogWrite(AIA, speed);
      analogWrite(AIB, 0);
      analogWrite(BIA, speed);
      analogWrite(BIB, 0);
    delay(wait); 
      analogWrite(AIA, 0);
      analogWrite(AIB, 0);
      analogWrite(BIA, 0);
      analogWrite(BIB, 0);
msg = 0;
}
else if (msg == 2){
      analogWrite(AIA, 0);
      analogWrite(AIB, speed);
      analogWrite(BIA, 0);
      analogWrite(BIB, speed);
     delay(wait); 
      analogWrite(AIA, 0);
      analogWrite(AIB, 0);
      analogWrite(BIA, 0);
      analogWrite(BIB, 0);
msg = 0;
}
else if (msg == 3){
      analogWrite(AIA, speed);
      analogWrite(AIB, 0);
      analogWrite(BIA, 0);
      analogWrite(BIB, speed);
    delay(wait); 
      analogWrite(AIA, 0);
      analogWrite(AIB, 0);
      analogWrite(BIA, 0);
      analogWrite(BIB, 0);
msg = 0;
}
else if (msg == 4){
      analogWrite(AIA, 0);
      analogWrite(AIB, speed);
      analogWrite(BIA, speed);
      analogWrite(BIB, 0);
     delay(wait); 
      analogWrite(AIA, 0);
      analogWrite(AIB, 0);
      analogWrite(BIA, 0);
      analogWrite(BIB, 0);
msg = 0;
}
if (msg == 5){
      analogWrite(AIA, speed);
      analogWrite(AIB, 0);
      analogWrite(BIA, speed);
      analogWrite(BIB, 0);
    delay(wait); 
      analogWrite(AIA, 0);
      analogWrite(AIB, 0);
      analogWrite(BIA, 0);
      analogWrite(BIB, 0);
msg = 0;
}
else if (msg == 6){
      analogWrite(AIA, 0);
      analogWrite(AIB, speed);
      analogWrite(BIA, 0);
      analogWrite(BIB, speed);
     delay(wait); 
      analogWrite(AIA, 0);
      analogWrite(AIB, 0);
      analogWrite(BIA, 0);
      analogWrite(BIB, 0);
msg = 0;
}
else if (msg == 7){
      analogWrite(AIA, speed);
      analogWrite(AIB, 0);
      analogWrite(BIA, 0);
      analogWrite(BIB, speed);
    delay(wait); 
      analogWrite(AIA, 0);
      analogWrite(AIB, 0);
      analogWrite(BIA, 0);
      analogWrite(BIB, 0);
msg = 0;
}
else if (msg == 8){
      analogWrite(AIA, 0);
      analogWrite(AIB, speed);
      analogWrite(BIA, speed);
      analogWrite(BIB, 0);
     delay(wait); 
      analogWrite(AIA, 0);
      analogWrite(AIB, 0);
      analogWrite(BIA, 0);
      analogWrite(BIB, 0);
msg = 0;
}
if (Serial.available() > 0) {


Serial.flush();


}

}
import processing.serial.*;

Serial myPort;
void setup (){
println(Serial.list());
myPort = new Serial(this, "COM10", 9600); // the number in the [] brackets may change
}

void draw(){ // Reads the keyboard input and sends the corresponding value to the arduino
if (keyPressed){
if (key == 'A' || key == 'a'){
myPort.write(3);
}
if (key == 'W' || key == 'w'){
myPort.write(1);
}
if (key == 's' || key == 'S'){
myPort.write(2);
}
if (key == 'd' || key == 'D'){
myPort.write(4);
}
if (key == CODED){
if (keyCode == UP){
myPort.write(5);
}
else if (keyCode == DOWN){
myPort.write(6);
}
else if (keyCode == LEFT){
myPort.write(7);
}
else {
myPort.write(8);
}
}
}
myPort.clear();
}

dfrail24:
how do I know that the Arduino and my laptop is connected via Bluetooth?

The LED on the Bluetooth stops flashing and goes steady