Runtime error when HC06 Bluetooth power off

Hello everybody,
I'm trying to pass some comma separated values from a HC06 Bluetooth to the MIT App. All is working well until I shut down the Bluetooth device (simulating a common error event). Although I handle the 517 error and try to disconnect gracefully, which is happening, the app gives me also a Runtime Error.
Do you have an idea why? And maybe some tips on how to avoid it?

  1. Must be "BytesAvalibleToReceive > 0", not "> = 0"
  2. Have you set DelimiterByte in Bluetooth component to value "10"?

Thanks @Patryk_F !
Setting "BytesAvalibleToReceive > 0" saves me from that runtime error BUT...now it won't give me any 517 read error. This I think I can handle by checking a receiving data timeout. Here's what I've done and it's working for the moment. Is it a more elegant way to do it or it's fine the way it is?

If it is necessary to disconnect BT when it is not receiving data then yes. This kind of time out can be used.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.