Bluetooth Low Energy doesn't receive data

Hi friends

I’m developing an iOS app to work with a Yourduino RoboRED Board (Arduino compatible) in order to control a robot via the App.

I want the App to be able to receive a character which an Arduino sends through the HM10 BLE module.

I used a timer set to 100ms to loop the BLE receive block, but nothing happens.

Please help me.

I have attached an image of the block.

Thank you

1 Like

Hi, @kufirre! :wave:


It might be that, the Bluetooth_Low_Energy1 call Receive is not receiving data.
To catch the error, try these blocks -

image

Note: Please use the else if instead of else in the if block.
There’s a little problem with else going on, hope the dev. s are looking over it.


Hope I helped you! :smile:

Thanks! :blush:

Wow. Thanks bro. Let me try this right away. I’d get back to you on the result ASAP

1 Like

This block looks like it only happens once. I need to constantly check for data coming in from the Arduino through the BLE module to the App. Therefore, I need a block to loop the BLE receive function.

Any ideas?

1 Like

Ok…
So, if you use a loop, I assume everytime you will get “V” as the response, right?
If so, Text to speech will continuously speak obstacle detected :sweat_smile: (It will be fishy…)

So, can you suggest another way you can replace the text-to-speech block?

Thanks! :blush:

Oh, actually, the Arduino sends the “V” whenever it detects an obstacle. Now, the App is supposed to be listening for this “V” in order to vibrate the phone and speak “obstacle detected”. That’s what I have in mind

1 Like

Oh :smile:
I will reply to u after 4-5 hours :blush:

Sorry bro. We are in different time zones… Really sorry for my late replies. It’s 9am over here

1 Like

Ok, I will provide approx time to you -

~ 2019-09-16T13:00:00Z

OK. Thanks

1 Like

Hi, @kufirre! :wave:


So, I understood your question :sunglasses: :stuck_out_tongue_winking_eye:


Your Arduino will send a " V " only if it detects an obstacle. Right? :thinking:

If so, try these blocks -


Hope it helps! :smile:
If any problem occurs, please inform :wink:

Thanks! :blush:

Hi @kartik14

I’m going to try this. Although, I feared that the while loop would cause the whole code to block?

1 Like

Hi, @kufirre! :wave:


Means?


Thanks! :blush:

In Arduino C programming, a while loop would cause the flow of the code to pause until the test condition becomes false. And here, the test condition is “true” (as in “while TRUE”), which would always be true. I was wondering if it would “block” the flow.

I’d try this and get back to you ASAP

Hi, @kufirre! :wave:


Do you have a C/C++ compiler right now?
If so, try this code - (you will understand about while true)

#include iostream

using namespace std;

int main() {
  while (true) {
    cout << "looping infinite times. (forever)\n";
  }
}

You will see, that it loops forever -


Thanks! :blush:

1 Like

I will catch you after few hours, (I am studying :grin:)
Probably at ~ 2019-09-16T15:00:00Z :wink:


Thanks! :blush:

I understand that. If you put anything else outside that “while true” block, that function would never happen.

Example:

#include iostream

using namespace std;

int main() {
while (true) {
cout << “looping infinite times. (forever)\n”;
}
cout << “do this after the loop\n”;
}

Hi @kartik14

Still receives nothing :persevere:

Don’t waste your, I think the staff already know about the problems on receiving data but don’t want to admit it.