Getting error as soon as the app opens

Hi, I am a newbie and decided to make an app after watching several tutorials.

I wanted to make an app which would start recording whenever the noise in the surrounding crosses a certain threshold. The components I used were Arduino Uno board, Bluetooth HC-05, Sound sensing module.

Whenever I open the app, it shows me the following message (attached).

This is the code, and the interface components I used.

Please tell me what I’m doing wrong, and if any other mistake you can point out?

Look at your logic. The clock fires, and the Bluetooth system has not yet connected, so Limit_Text is not updated. Yet right after that, you check the non existing (empty string) value of Limit_Text against 59.

How do I connect the Bluetooth system (Sorry I’m really new)? Doesn’t it connect when I pick a Bluetooth device from the addresses?

Hi @wolfman.sharmamrpm - it’s probably best to have a button the user can click on to connect manually?

Sir the app is not even opening. As soon as it opens, it shows the error I attached a screenshot of.

What do you mean, the error that you cannot compare an empty string to 59?

I already mentioned that your program is testing the value even if it failed to be connected. Just move your test logic INSIDE the “if is connected”.

I moved the logic within the “if is connected”, like you asked me to-


Now the app connects with the Bluetooth module but soon after shows this error-

The error is not form the logic blocks you show.
There is only instance of the “>” operator in the blocks you show, and that is to determine the number of bytes received. So either “Bluetooth_Client1.Bytes Available To Receive” returns “[ 47 … 50 47 … 50 (…)”, or the error is somewhere else in another logic block.

Does that mean that the app is unable to receive the bytes from the board? How do I fix it?

No, that does not means that. I did write that the error may be somewhere else in your code. You assume that it is in the Clock1.Timer block, which may or may not be the case.

If the error is triggered at the level of “call Bluetooth_Cilent1.Bytes Available To Receive > 0”, have you considered getting the result of “call Bluetooth_Cilent1.Bytes Available To Receive” to be posted out through a Notify Alert, so that you can examine it?

Sir I started checking for errors step by step.

I left the textbox empty in which I’d receive the values from the board.

I disabled everything else and here’s the code still enabled-


On trying out the app, it shows the values like this, instead of individually-

There you have it. Whatever bluetooth client you have does return “[ 47 ---- 50 47 ---- 50 (…)” as response to the Bytes Available To Receive query.

The reference information at says

|Bytes Available To Receive| Returns an estimate of the number of bytes that can be received without blocking.

So, that is what you get. I do not know what your arduino sends out, but that is what the app claims it gets.

1 Like