Bluetooth Configuation

Hi!

Im making a project that consists in arduino and android communication (App Inventor V2) through bluetooth (HC-05 Module). Im using a bunch of Ultrassonic modules too to alternate if i want to drive the robot or i want him to drive itself. The problem is that right now, im only able to do that while connected to bluetooh, and i want to know how can i make my robot drive itself without bluetooth or with bluetooth if i want or not.

Inteligent_Robot.ino (4.88 KB)

int uS1 = SonarFrontLeft.ping();
delay(50);
int uS2 = SonarFrontRight.ping();
delay(50);
int uS3 = SonarLeft.ping();
delay(50);
int uS4 = SonarRight.ping();
delay(50);

You are using the NewPing library which doesn't block, and then sticking your thumb up your ass for a while after each reading. Why?

What does the code actually do? How does that differ from what you want?

How is the robot to decide whether it is going to be controlled by bluetooth or not?

Sry im a begginer in arduino i need help exactly for that, how to block the newping controll when i connect the bluetooth, and how to enable again when i disconnect without interfering with the android commands.