Have you tried:
Hi Chris,
Hopefully the microbit version is latest. I got it from Dubai yesterday only. The model version is V2.21 of microbit.
microbit-BTConn (1).hex (1.3 MB)
BLE_permissions_allAndroidVersions (2).aia (192.2 KB)
Error 980: The permission BLUETOOTH has been denied.
So - you do need to switch Bluetooth on in the Phone's settings first, before running the App, or in-app:
.... then request Permission.
It has been a while since I made it, but nothing much has changed in the AppInventor support for BLE as far as I know, except this permission stuff. The version of the micro:bit does not matter. You can even connect to a V1 micro:bit, although it will run out of memory much faster.
What I saw in you .aia is that you actually never connect to the micro:bit, so no wonder.
Try my tutorial here: App Inventor, Micro:bit and UART
It does exactly what you need, except that you may need to add permissions.
Something else to note: in makecode, go to settings->project settings and set: No Pairing Required.
That will save you a lot of headache.
Concerning the .hex app, I am not so sure it will work properly. You have to be very careful, or else it will run out of memory. Look at mine. It works.
I made some apps to control a robot car, but as said it is rather limited, momory is never enough.
Also it is a real pity that the BLE extensions were never properly updated, but if you use the really old one for the microbit (UART only) it will work.
Let us know how you go.
Hi Chris, I followed your instructions. But still the error persists.
I do not know what mistake am I making.
No Block asking for permission?
Side note - having the scanned addresses go straight into the List component could omit devices that have not been discovered yet. It's usually a good idea to use a Clock timer.
Thanks @Ghica I will try your apps tomorrow morning.
Hopefully your apps will help me to send message from microbit to mit app (mobile) and display it in a label.
@Ghica @Anke @ChrisWard
I am trying to use applications provided by @Ghica (reference: App Inventor, Micro:bit and UART)
It seems like it does not support Android 12, as blocks for BLUETOOTH_CONNECT and BLUETOOTH SCAN are missing.
I added the blocks for the same in the mit app.
But getting errors:
Refer to the updated mit app:
BTReadWrite.aia (296.0 KB)
Help to resolve these issues for BT connectivity.
Android mobile version 12
Thanks in advance.
And again and again and again ...
Use the current version of the BLE extension!
See post #73
.
Uhhh Ohhh!
Sorry I missed out on updating BLE extension.
Thanks for the response.
I will keep this in mind... ( )
Sorry, I may be stupid, I intended to update my tutorial this morning, but where is the updated extension??
Another point, you may wonder what the webviewer running JavaScript is for in my example. It is needed because there is still no way to convert the Ascii you recieve from the micro:bit to characters AppInventor can handle. So, if you want to display your text in your label, you better use this.
I tried this (and removed the Location
permission in the Manifest) to get rid of the Location
permission / request, but it doesn't seem to work (on Android 12+):
<uses-permission android:name="android.permission.BLUETOOTH_SCAN"
android:usesPermissionFlags="neverForLocation" />
I am not really sure what I can do, except buying a new phone
But the real question is what is @Sudarshan_Gupta able to do.
And again, he should use the current BLE version.