I did a project using the Arduino and App inventor sending and receiving data, and I also used the HC-05 Bluetooth. Make sure that your Bluetooth is set to the clock speed of your phone's Bluetooth. I have an S3 phone so the clock speed I set was 57600.
In the file "bluetooth.png", the first two things you must do is have a way to select the Bluetooth device. When the device is on, make sure your phone is able to find it and connect to it. Next is being able to connect to the Bluetooth in the application which is completely separate from connecting it the phone. Now that we understand this, you can make your blocks based on the image.
To explain the code, the button that is being used is a list picker component. Before the button is pressed, the application will retrieve a list of Bluetooth devices available in your range. After the button is pressed, you will get a list of the Bluetooth devices available, once you click on your device, the HC-05 will begin blinking slowly verifying that you are connected.
The next part is in the file "bluetooth2.png". Here we have a clock controlling when data is being received from the Bluetooth. We put ".BytesAvailableToReceieve > 0" to see if data is available. Afterwards, we use the ".ReceiveText" with a "BytesAvalableToReceive" attached to it and set it to a global or local variable, and that's it.
*Couple of important notes while doing this project:
- I implemented a clock to control the time it takes to retrieve data. The reason I did this is to prevent possible overflow, from what I could remember, the Bluetooth can store up to 64 Bytes before it begins to stop accepting data. Timing is very important! From the Arduino side, do it in the same manner, if anything, add delays to slow down the loop function when it sends data to the Android phone. Make the clock on the application have a faster clock speed speed to be able to remove any data from the Bluetooth as quickly as possible.
- From the Arduino side, you can use "btserial.println" to send a string of data to the phone, and this is assuming you are using softwareserial for communication. If you send values, you will be limited to sending only a byte at a time and then you will have to manipulate the blocks to collectively get the data after every byte which can get messy. In other words, since you're still adjusting to app inventor, convert your data value to a string on the Arduino and then send it.
Best of luck! If you have any further questions, I will be happy to answer them.
Edit: Forgot to mention the timing for the Arduinno