Connecting BBC microbit V2 to Mit App Inventor

Here is a link to my tutorial, which includes a ready made .aia and a .hex file for communication between AppInventor and micro:bit.
I have updated the .aia to include the newest BLE extension.

2 Likes

Thank you very much @Ghica

We created an App but it keeps crashing when it is to connect to a microbit

I lost my crystal ball, so I have no clue what may be the problem. Please upload the .aia and the .hex file of your project.

1 Like



It worked well before then the app started crashing(closing) when it tries to connect.

Two remarks: from your blocks I cannot see which BLE extension you are using. You can find it here: Minor BLE Extension Documentation Mistake - #10 by Mr_Czechowski
or here: MIT App Inventor Extensions
The second remark: with the newest BLE extensions you do not need to ask for permissions anymore.
Try it.

It is not still working, do you have any tutorial you can point us to using the updated extension. The most painful thing is that it was working perfectly before it started crashing. Can you chat me up on Whatsapp Removed by mod

I do not do whatsapp.
What happened when your app started creashing? Any error messages?
You did not do what I asked: attach your .aia and your .hex and I promise I will take a look.

For downloading an .aia look here: Sharing and Remixing Apps
For downloading a .hex, if you have your project in microsoft makecode, look at the bottom of the page for download options.

IoT_STARTER2 (1).aia (488.2 KB)
microbit-Door-and-LightBLE-working.hex

Above are the files

Ok, so far I destroyed two microbits trying to load your .hex
I took a brand new one, and took out some stuff, because I cannot connect io pins. Here is my .hex:
microbit-DoorLight4.hex (1.3 MB)
This works. (I will be able to reset the other micro:bits I hope)
Your .aia works too, except that, once connected, you cannot disconnect because you set the visibility of the button arrangement to false.

Okay, thanks I will try it out and get back. The reason why there is no pin is because we are using microbit extension. And again why didn't the other two Microbit work. But did you connect several times. Because for us it worked before and then started crashing after connecting up to two or three times

You never told me what the symptoms of the crashing were, therefore I have no clue about the reason. Also, your .aia and your .hex were different from the screenshots of your blocks, so I have no clue what could have been wrong there.
The problem with micro:bits is that you must be very careful about memory usage and you never know when too much is too much.
Anyway, it could be a nice app when you get it to work!

Yes, so the last files I sent did work well, the microbit connected successfully up to 3 times and started crashing. The App closes when it is about to connect with the microbit. You will be able click on the microbit to connect. But when it is connecting the App closes.

6 posts were split to a new topic: MicroBlocks and App Inventor


Thanks for the support so far. I used another phone it requested I clear the cache after doing that it worked after crashing once. And later started crashing again and I got the error message attached.

I removed your phone number a second time. Please don't post personal info on the community.

Start reading here Get Started - MicroBlocks

For the time being I stop posting in this thread, to avoid confusion.

Why? I can always try the two. I really want to make this work.

I think it will be too confusing to try 2 things if you are beginner at both.
You can continue with the "old" version, basically the .aia and the adapted .hex; and as I told you it basicially works fine. You could now add the io-stuff on the microbit again and see if that works for you. If there is a problem, you have to be very explicit about the error you are experiencing and any error messages you see. Because we cannot guess what is wrong without any information.

At some time later I will look at Peter's stuff but not immediately.

It is also important to note here that the Android BLE stack will memoize the available services for a given BLE peripheral. This can lead to possible issues in App Inventor because currently we do not force a refresh of the services on every connect. This can cause problems if you change your micro:bit code to use different services from the set that was enabled on the first connection.