I am working on arduino uno blutooth control car

when I connect bluetooth module with android app. Error 516: broken pipe occur when i click on any button. anyone help me how to fix this bug.

Your block images are unreadable.

If you search this board for '516' you get a lot of hits.

I am guessing yours might be

You are losing your BlueTooth connections, for some reason.

I search about this error and I found that there is a problem in Rx Tx connection but i check my circuit there is no problem in circuit connections. i also connect all circuit again but problem not solve.

This post was flagged by the community and is temporarily hidden.

Post your wiring diagram and your .ino file.

Maybe one of our hardware people can spot something.

All_in_One_Robot.ino (7.7 KB)

In your Arduino code you never send at least one byte or one character to maintain alive the communication between the app the the board. I suggest to send periodically (i.e. every 30 seconds or one minute) a "live" character from the UNO board to the app, so to keep awake the BT client on app's side.
Of course you shall code in the app a clock block to poll periodically (i.e. the half of the period of the "live" sending from Arduino) the incoming BT line.
This is to avoid that, after a certain period of no-BT-activity, the BT cliient, on AI2 side, considers the BT ceased and disconnects itself.

Another hint is to not use the delay() function of Arduino, because it stops the serial communication (while delaying) but rather you can use your one, like:

ddelay(int Tme_To_Wait)
unsigned long now = millis();
while( (millis()-now) < Time_To_Wait); // do nothing but leave the CPU alive

use is: ddelay(2); // wait 2 milliseconds

Give it a try.

EDIT what kind of BT shield are you using ? HC05 or HC06 or a BLE one (i.e. HM10) ?

1 Like

I am using HC05

I don't understand how to edit code bc I am beginner in this field .Could you edit this code for me how you say and attach it here ,plz

now my car is working but after 30sec Bluetooth stop working and when i click any button it show error 516 unable to write broken pipe