Bluetooth advertising

How to make a mobile device to publish or create a Bluetooth advertising method to deliver information, or advertisement to mobile devices in a short range. Anyone has any idea or example blocks? I try to use StartAdvertising but it is not work.

I have not used this, but I notice you are asking immediately after starting.

Maybe a delay is needed before testing Is Advertising?

Add a Clock Timer for the advertising test, and move it there.

It works well. Thank you very much.

This is hilarious.

Your Clock Timer is only delaying your same original mistake 3 seconds after you click the Start Advertising button.

The thing that made it work was probably the assignment into Label2 that was inserted between the initiation and the test.

That little bit of work might have supplied the required delay.

The safer design is to start advertising in the button click event before starting the Clock, and move the Advertising test to the Timer event.

Thank you for your suggestion. It works.

1 Like

@ABG I have another question. I tried to use the "AdvertisementData" method but it returns the advertisement data as a byte array like this "[80, 65, 78]". How can I convert these byte array into string.

I had this in stock from a previous thread, where some bytes had to be removed from the data stream. Cut that part out.

AsciiCHRASCprocedures.aia (4.4 KB)

chr

strip_STX_ETX

P.S. This will not handle Unicode multi-byte text.

1 Like

Thank you for your help

@ABG I have one question about AdvertisingData method. What is maximum data size that I can advertise data? Because when I tried to add more characters or data length, the method does not work.

Search this board for BLE MTU for a direct answer.
(I have not used it or BLE yet.)

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