Error 507 hc 05 bluetooth module continuation

Is it just a random error that will be like solved by itself?

:thinking:
Gasp !
let me say in a different way: the Input buffer is initialized as a global text "empty", then it is filled every time a BT frame arrives.

As far as the stuck app is concerned, I mean that since AI2 has a "single thread" structure, it can perform only one task at a time, so if the app is trying to connect the BT, it cannot do anything else, and other events (like handling the pushbuttons) cannot run, but they are queued until the connection attempts finish their job.
(hoping it'a a bit clearer :grimacing:)

Never trust in "random error" : they will never be solved by themselves !!!
On the contrary: random errors are the worst ones because you'll never know when they happen and are the most difficult to solve.
(According to Murphy's laws they will surely happen when the damage that they can do is the maximum!!!).
:rofl: :rofl: :rofl:

Yeah but the thing is that I successfully connected to the bluetooth between hc05 and the mit app inventor but after it was connected nothing reacts afterwards. About the murphy's law, you are absolutely right :joy::roll_eyes::grin:

Can you post your "last" aia ?
I'll give it a look (probably not tonite, I have to revise a quantum mechanic lesson for my son for tomorrow). But never say never... :smirk:
Ciao

There you go:
USKled_1.aia (5.0 KB)
Priorities first! When you catch some free time...

Dear @Bruno,
I tried your .aia and it works perfectly with the Arduino UNO .ino annexed file
BT_Send_Monitor.ino (1.9 KB)
After the connection, by pressing any button (2,3,4,5) I can read the feedback (2,3,4,5) this means that the BT works full duplex and the buttons aren't blocked.
Therefore I don't know what happens to you... :thinking:
But now i shall follow my son.....

Well thanks for your fast reply and feedback, I will try it again tomorrow to see what might be a problem here. Good luck and take care!

1 Like

HI,I tested it and the error is in the clock timer blocks apparently since after I removed it everything worked fine...

Dear @Bruno,
happy to hear that !
But what was the "error" in the clock ? Your .aia was working fine on my desk, without any modification, nor in the clock, neither in the rest of codeblocks.
Which part of the clock did you remove ? (I don't think you have removed the entire clock, otherwise you cannot receive anyhing from Arduino):
Cheers !

Well I removed everything just so I can know whether it is the code, the app or smth else. I will try again removing little by little

Hmmmm,
if the clock1 stukcs any other block, this can happen if the receiving buffer is always replenished by (spurious ?) characters ...
image
This instruction waits and fetches characters until there are any in the receiver buffer.
Are you sure that your Arduino is not sending "forever" characters or rubbish ?
With the Serial Bluetooth Terminal app, is your Arduino working fine ?

Witb SBT it works just fine as it does without clock timer. With clock timer I realized that the app does not react and sometimes when I oress back button on the phone it starts to show data received to the arduino, (those ones and zeros which I actually wanted that are stored in the label, but only showed ones since I didn't press my switch). Sometimes I saw a character with a question mark at the beginning of those 11111...

With SBT it works just fine as it does without clock timer. With clock timer I realized that the app does not react and sometimes when I oress back button on the phone it starts to show data received to the arduino, (those ones and zeros which I actually wanted that are stored in the label, but only showed ones since I didn't press my switch). Sometimes I saw a character with a question mark at the beginning of those 11111...

Strange behaviour.
Sometimes question marks mean that the receiver cannot "decode" the received character, as if the baudrate was not the correct one or if there is a parity error. Are you sure that your HC05 is working fine ? Do you have anotehr one, just to try whether it's defective ?

Well I have 3 of them currently I can try them all with the clock timer blocks but I don't think it is about the module. I will try it this afternoon after school after which I will share the results. Cheers!

Ok, I agree with you that a defective hardware is often the last chance, but some cheap HC05 are not "the best" in terms of quality.
I guess that there is still some difference between my setup and yours, since the last .aia you sent me, and my Arduino UNO code, that I sent you, are working perfectly. :flushed:

PS Honestly there is still a "software difference": my devices that I've used for test, feature Android 8,9,10 in which the harsh permissions required to work with Android >= 11 aren't necessary !!!

For the hc p5 part, I have one that has no button which was 20 euros and 2 with button which were around 7 euros. I will try them all with clock timer blocks and tell you the results.
For the blocks, I assume all 3 of these glibal variables are needed here
Screenshot_20240209_130217_Chrome

The HC05 shield with or without button should be the same as far as the coding interface is concerned. I annex a couple of data sheets to let you have some deeper info about.
The bool variable BT_connected is intended to let the rest of the code knowing whether the BT is still connected or not, without checking always the successful connection.
BT_Buffer or BT_inputBuffer variables are (probably, if I remember correctly) the same: each of them is a "temporary storage" variable. Probably I wrote two different names while recreating the example for you (the first time and yesterday).
The rationale is that when the code receives a frame/string from BT, this frame shall be collected and stored entirety [receivebytes (-1)] into a variable. Then this variable can be duplicatd/splitted/copied into another working variable, without affecting the "original" one, that remains available for other steps of the code.
The unique precaution is that this buffer shall be cleared/emptied before attempting to receive a new frame. This is to avoid that some spurious characters remain and affect with unwanted (old) characters the new incoming message.

HI, after I tested it with all 3 of them. results are the same, after connecting I cannot press any of the buttons while clock timer blocks are included.



The screenshoot says that led (app) does not react and asks whether to close it or wait