Data from Arduino is not shown in App

Good evening, I have been working with the MIT App Inventor and Arduino IDE for a few weeks but I am still relatively new to both softwares. I'm doing a project with various components but the part that has given me problems is sending the data from the pressure sensor connected to my Arduino to the app. I am using a HC-06 bluetooth module in which I'm able to connect it to the app, and the serial monitor in arduino shows the value of the pressure sensor. However, when I install the app on my phone, the value is not shown. I greatly appriciate any help.

Below I attached the Arduino code and the MIT App Inventor block code


Set your Delimiter Byte to 10 in the Bluetooth client and request -1 bytes.

Shouldn't you have another Serial stream to the Bluetooth device, in addition to your console stream?

And why are you splitting at '|' if you are not sending '|'?

1 Like

In addition to what @ABG has already said, your
#define fsrAnalogPin (A0) should be #define fsrAnalogPin A0 // without parentheses
Probably it works (depending on which level of warnings have you set in your IDE), but for sake of code cleanliness....

Then, to which pins have you connected the HC06 ? What Arduino board are you using ? If you connect the HC06 to pins 0,1 you don't need the use of the SoftwareSerial library, but be aware that everything you send on those pins will go both on the Serial Monitor and to the BT. Is this what you want ?Are you sure that the HC06 baudrate is 9600 ? (some of them have a manufacturer's setting to 38400). Please also be aware that the Tx and Rx pins shall be reversed between the Arduino board and the HC06.
A lot of stuff, I reckon, but before getting crazy in searching for ghosts... :rofl: :rofl: :rofl:

PS To be sure that on Arduino side everything is working fine, you can use the free app Serial Bluetooth Terminal that you can download from Google PlayStore.
Best wishes.

@uskiara The HC-06 is connected to analog pins 1 and 2, and I'm using an Arduino Uno R3. Would I still need to use the Software Serial library if the HC-06 is connected to 1,2? For the Tx and Rx pins, would the Tx pin on the module be connected to the Rx pin on the Arduino?

How could I add a serial stream to the Bluetooth device?

There are many samples in that thread.

Dear @Aaron_Castro,
please refer to my answer #25 to the follwong topic:

You will find therein a complete working project on both Arduino and AI2 sides, c/w a schematic diagram (don't care if it refers to an Arduino Nano, the rationale is the same).
Anyway please pay attention that the hardware serial line on an Arduino UNO is allocated to digital pins 0,1 not 1,2 and yes, the Rx pin of Arduino shall be connected to TX of the HC06 (or HC05, is the same) and visa versa.
At the end, I suggest you to let the pins 0,1 allocated to the serial monitor, maintain the SoftwareLibrary and connect the HC06 to pins 10,11. In this way you'll have on separate lines the BT and the Serial Monitor thus avoiding any risk of data collision.
Whether all the above is not sufficient, or clear, you'd rather have a look to the @Juan_Antonio's web site, as @ABG has already suggested.

1 Like

Thank you @ABG @uskiara so much for your help, I was able to get the data sent to the app. The problem was that I had to change the Tx and Rx connection of the HC-06.

1 Like

Dear @Aaron, nice to read that!
Best wishes for your project(s).