problem of sending data of the ultrasonic sensor to computer through bluetooth

The problem of sending data of the ultrasonic sensor to the computer through Bluetooth.
I would like to send the data of the ultrasonic sensor to my computer through Bluetooth and watch it the serial port. However, when I open the serial port it do not show anything.:

Here is the code:

#include <SoftwareSerial.h>
int In1 = 22; //right motor
int In2 = 23;
int In3 = 24; //left motor
int In4 = 25;
int ENA = 10;
int ENB = 9;
int trigPin1 = 11;    // Trigger1
int echoPin1 = 51;    // Echo1
int trigPin2 = 12;    // Trigger2
int echoPin2 = 52;    // Echo2
int trigPin3 = 13;    // Trigger3
int echoPin3 = 53;    // Echo3
SoftwareSerial BluetoothSerial(0, 1); //RX TX
long duration, distance, leftSensor, frontSensor, rightSensor;
void setup() 
{
 Serial.begin (9600);
 BluetoothSerial.begin(57600);
 pinMode(0,INPUT);
 pinMode(1,OUTPUT);
 pinMode(In1,OUTPUT); //right motor
 pinMode(In2,OUTPUT);
 pinMode(In3,OUTPUT); //left motor
 pinMode(In4,OUTPUT);
 pinMode(ENA,OUTPUT);
 pinMode(ENB,OUTPUT);
 pinMode(trigPin1, OUTPUT);
 pinMode(echoPin1, INPUT);
 pinMode(trigPin2, OUTPUT);
 pinMode(echoPin2, INPUT);
 pinMode(trigPin3, OUTPUT);
 pinMode(echoPin3, INPUT);
 BluetoothSerial.print("Starting ...");
}

void loop() 
{SonarSensor(trigPin1, echoPin1);
 leftSensor = distance;
 SonarSensor(trigPin2, echoPin2);
 frontSensor = distance;
 SonarSensor(trigPin3, echoPin3);
 rightSensor = distance;
 BluetoothSerial.print("leftSensor: ");
 BluetoothSerial.print(leftSensor);
 BluetoothSerial.print(" cm ");
 BluetoothSerial.print(" - ");
 BluetoothSerial.print("frontSensor: ");
 BluetoothSerial.print(frontSensor);
 BluetoothSerial.print(" cm ");
 BluetoothSerial.print(" - ");
 BluetoothSerial.print("rightSensor: ");
 BluetoothSerial.print(rightSensor);
 BluetoothSerial.print(" cm ");
 BluetoothSerial.println();
 delay (20) ;
 if (frontSensor > 30) { forward() ;} //if front obstacle distance > 30cm, car move forward
 else if (frontSensor <= 30 && frontSensor >= 5) //if front obstacle distance <= 30cm and >=5cm
 { 
  if  (rightSensor >= 25 && rightSensor > leftSensor) { rightturn() ; delay(1000) ; forward () ; } //if right obstacle distance >= 25cm and right obstacle distance larger than left obstacle distance.
  else if (leftSensor >= 25 && leftSensor > rightSensor) { leftturn() ; delay(1000) ; forward () ;} //if left obstacle distance >= 25cm and left obstacle distance larger than right obstacle distance.
  else {stop(); }
 }
 else { stop() ;}
}
 
void SonarSensor(int trigPin,int echoPin)
{digitalWrite(trigPin, LOW);
 delayMicroseconds(2);
 digitalWrite(trigPin, HIGH);
 delayMicroseconds(10);
 digitalWrite(trigPin, LOW);        // Write a pulse to the HC-SR04 Trigger Pin
 duration = pulseIn(echoPin, HIGH); // Measure the response from the HC-SR04 Echo Pin
 distance = (duration / 2) * 0.034; // Determine distance from duration
 }
void forward() // car move forward
{
analogWrite(ENA, 250); // Sets speed variable via PWM
analogWrite(ENB, 250); // Sets speed variable via PWM    
digitalWrite(In1, LOW);
digitalWrite(In2, HIGH); 
digitalWrite(In3, HIGH); 
digitalWrite(In4, LOW); 
}
void stop() // car stop
{
analogWrite(ENA, 250); // Sets speed variable via PWM
analogWrite(ENB, 250); // Sets speed variable via PWM      
digitalWrite(In1, LOW);
digitalWrite(In2, LOW); 
digitalWrite(In3, LOW); 
digitalWrite(In4, LOW); 
}
void leftturn() //car turn right
{
analogWrite(ENA, 250); // Sets speed variable via PWM
analogWrite(ENB, 250); // Sets speed variable via PWM      
digitalWrite(In1, LOW);
digitalWrite(In2, HIGH); 
digitalWrite(In3, LOW); 
digitalWrite(In4, LOW); 
}
void rightturn() // car turn right
{
analogWrite(ENA, 250); // Sets speed variable via PWM
analogWrite(ENB, 250); // Sets speed variable via PWM    
digitalWrite(In1, LOW);
digitalWrite(In2, LOW); 
digitalWrite(In3, HIGH); 
digitalWrite(In4, LOW);
}
void backward() // motor move backward
{
analogWrite(ENA, 250); // Sets speed variable via PWM
analogWrite(ENB, 250); // Sets speed variable via PWM      
digitalWrite(In1, HIGH);
digitalWrite(In2, LOW); 
digitalWrite(In3, LOW); 
digitalWrite(In4, HIGH); 
}

What board are you using? The typical pins for the Serial port are 0 and 1 [Serial.begin()] yet you also use them for SoftwareSerial.

blh64:
What board are you using? The typical pins for the Serial port are 0 and 1 [Serial.begin()] yet you also use them for SoftwareSerial.

arduino mega 2560

You are using software serial on hardware serial pins 0,1 - a fatal mistake.
Using software serial at all on a Mega, with four (4) proper hardware serial ports, is doubly dumb.
You are calling software serial @ 57600, also fatal.
You are also calling hardware serial pins 0,1 @ 9600, probably redundant, and another recipe for disaster.
With all the above going on, I bet you have not configured Bluetooth to run at 57600 anyway. Also fatal.

You might try

  1. delete all reference to software serial
  2. call serial 2 @9600 in setup
  3. put bluetooth on serial 2, pins 16,17 as clearly marked
    4 swap all bluetoothserial.print command to serial2.print
  4. Check wiring Rx>Tx and Tx>Rx

Then see how it goes.

You seem new to Arduino. Take your project in steps.

First of all, only interface ultrasonic sensor with Arduino and then display its value on your serial monitor.

Once it's done then interface your bluetooth module with Arduino and test it out on your serial monitor, there are bluetooth android apps are also available which you can use to send and receive data.

& Finally combine the two i.e. send your sensor's data via bluetooth.