Microbit BLE ERROR

Hello, please help!

There is a microbit board written by the application in the Mit app! , when trying to connect, it gives an error, - Service (service number), the characteristic is not published by the connected device. Tell me what to do? I enclose the code in the attachment.

Hi, did you try the tutorial to do a simple connection first?
And what do you have on your micro:bit?
Did you see the tutorials here:
Cheers, Ghica

I used this code in December, did not change anything in it, but now an error occurs when I try to connect! I don’t understand what’s the matter.

Please help me figure it out, I broke my brain ...

So a couple things to check:

  1. If you loaded an alternative sketch on your micro:bit, such as one developed using Microsoft MakeCode, then you will probably want to reset to the default sketch from the micro:bit website.
  2. If you're installed a custom sketch with the intention of using our extensions, then you may need to turn your bluetooth off and on again so that it forgets any cached information about its connection to the micro:bit.
  3. Make sure in your custom sketch that you enable the appropriate BLE service for the part of the extension you intend to use.

Hello! Thanks for the answer! Made as you recommended, but the error repeats. Source code to connect Microbit to smartphone?

Could you please post your .aia here and if you have a .hex file made with MakeCode, that one also.
What did you specify for pairing? Could be: no pairing required, Just works, or Passkey pairing.
I can maybe try it out then.
Cheers, Ghica.

Many thanks for the help, I attach aia to the message.
The hex function does not require a connection, connect to any available device. And included bluetooth input pin io pinBLE_microbit.aia (759.6 KB)

Hi Klim,
Thanks. It is hard for me to try your app without a .hex file for the micro:bit.
Anyway, looking at your .aia I found that you are using outdated versions of the BLE and the micro:bit extensions. It may help to replace them with newer ones at http://iot.appinventor.mit.edu/
Cheers, Ghica.

Thanks for the answer! Maybe someone could lay out a chat code for connecting a microbit to a smartphone? And I’ll add Dalia!

Look here: http://iot.appinventor.mit.edu/assets/howtos/MIT_App_Inventor_Basic_Connection.pdf
Make a .hex file like this:

And, to prevent a lot of headaches, go to the settings and set no pairing required.

Thank you so much! But I need code written in Mit APP.

Guys help, please discard the working version of the code that connect the microbit to the smartphone.

I gave you the link to the pdf where this is explained. It is the same for all BLE devices.

I tried to follow the instructions. Nothing works. Maybe someone has a code to connect a microbit to a smartphone?

Doesn't anyone have a piece of code to connect microbit to a smartphone?

It should work with the out-of-the-box Micro:bit code. Once you start changing the code by using MakeCode, then you'll need to potentially reset your Bluetooth connection for it to work. Service and characteristics are cached by Android so that it doesn't have to query them again on future connections, but if you've changed the code on the device naturally it might have different services/characteristics than before. Usually turning the Bluetooth off and back on again is sufficient to achieve this. I would recommend starting with the stock hex code for the micro:bit and our micro:bit tutorial to make sure that all works first and then you can start customizing the micro:bit code from there.

I gave it to you above. You need a hex file on your micro:bit that you can make using MakeCode as described above. Then, on your phone you can create the app as described above also.

Or, if your micro:bit is still unchanged, out of the box, you can use the same app. The tutorial is already given to you twice. see above.

What do you want to do with the micro:bit when you have connected it to the phone?

Hi I have just encountered the same problem as mentioned. Would it be alright for you guys to help me spot the errors in my code as I am quite new to this. Thank you.

Hi sir,

Could you kindly help me to debug my code? Thousand of thanks!