HC-06 and Rc Car MIT app Connection Problem

I made an RC car car myself over arduino. I make connection with Hc-06. There is no problem when giving full instructions with the program I installed from the Google store. But when I run the program that I have made through MIT app, the complete communication is broken after a few commands. And the bluetooth turns off completely. Bluetooth does not see when I switch to the program I downloaded from other Google Store. I have to close the vehicle completely and turn it on again. Could you please help, is it through bluetooth or not?

We would need to see your App Inventor Blocks and Arduino Sketch Gokhan.

tam_1.txt (10.3 KB)

There may be a disagreement because I wrote in my language. If it’s incomprehensible, I can translate it.

Hi gokhan

  1. one issue may be your use of touch-up/touch down. What are you running your App on (Device Make & Model, Android Version)?

  2. Do not switch on the Clock Timer until it is actually required.

  3. When Bluetooth is connected, switch off the Clock Timer.

  4. It is best to set-up Clock Timers in the Blocks (On Screen Initialization)

  5. Location must be switched on (Google security measure).

I attach a basic “template” Project for Classic Bluetooth (aka BT). A lot of it applies to your Project, with the exception of how the commands are sent to your Arduino Car.

Re the Sketch tam_1.txt

  1. In the Main Loop, where is the Serial.println() data going to?
  2. Generally, do not use Delay() in the Main Loop, it delays everything. Instead, use time elapsed (see attached simple example, which is Arduino-to-App, but the time elapsed part does apply to your Project)
  3. Do not assign the type of variables inside a loop!
  4. Instead of a mass of if-else-ifs, you might consider using switch instead.

So, in some cases you are sending two items of data very fast in succession when you touch-untouch a button, but I think the Script might not handle receiving data in that way. Of course I could be wrong but that is my hunch. Let’s get the basics fixed first.

BT_Basic_Setup.aia (8.4 KB)

BasicTestArduinoToApp.ino (826 Bytes)

By the way, next time you capture Blocks as an Image, please use App Inventor’s “Save Blocks as Image” which you will find on the right-click pop-up menu.

Another thing - Arduino’s processor and the HC06 could be getting too hot. If you can add a small fan to the car to keep it cool that would make a difference.