Skip to first unread message
Assigned to ewpa...@gmail.com by me

MicroICc

unread,
Aug 31, 2017, 5:27:35 AM8/31/17
to MIT App Inventor Forum

Hi to all,

trying to connect those two wonderful product with ANDROID BLE connections., but there is a lot of problems.

I confirm that one example I found from Ghica working: Micro_bit_temp , but after a lot of troubles with forcing microbit to work.
Anyhow this example use BLE extension not microbit.

Then I try to connect both examples form http://iot.appinventor.mit.edu/assets/howtos/MIT_App_Inventor_Microbit_LED.pdf
and http://iot.appinventor.mit.edu/assets/howtos/MIT_App_Inventor_Microbit_Temperature.pdf
but without success.

Is there any working example with micro bit extensions. I should mention that I exactly follow both PDF documents, and my both units are paired.
I receive several errors on screen during android application test,`<init>' in class com.bbc.micro bit.profile.Microbit Led,invoke: no method named `WriteLEDText' in class java.lang.Boolean, etc.

This what I try is to enable my two sons age of 10 and age of 11 to have a nice start for develop their ideas. They already work with android and arduino over BT.

Thanks and regards,
Damir

Evan Patton

unread,
Aug 31, 2017, 8:49:52 AM8/31/17
to MIT App Inventor Forum
Hi Damir,

Thank you for the report that you are having difficulty with the IOT extensions. In general, all of these sample projects should work on devices running the companion version 2.43 or higher on Android 5.0 or higher. I have a few follow up questions that might help us diagnose the issue with the micro:bit extension:

1) Which version of the companion are you using? 
2) What device and version of Android are you using?
3) Are you building the app from scratch or are you using the completed AIA linked from the PDF?
4) Do you only have this issue when using the companion, or do compiled apps fail to run as well?

Regards,
Evan

MicroICc

unread,
Aug 31, 2017, 4:44:42 PM8/31/17
to MIT App Inventor Forum
HI Evan,
thanks for reply.
Android version 5.0  + phone Samsung Alpha
AI version 2.44

So far I did try several application from scratch and all of them working, but non of them use BTLE or BT. Last one I try is to build micro:bit with Samsung, but no success. I reset my computer as well start pairing several times from 0, but nothing happen. All time I receive init  or invoke error wit microbit extensions. I should try download application and try.
Will inform you back.

Regards,
Damir

Message has been deleted

MicroIC

unread,
Sep 1, 2017, 7:19:49 AM9/1/17
to MIT App Inventor Forum
little bit update!

what I should run on micro:bit to be able to connect with MICROBIT extensions to unit.
As I understand micro bit should advertise his address on bluetooth even without any program in his memory.

I start bluetooth temp service on micro:bit and I am able to connect with Microbit_Temperature extension of AI and read temp changes.

I am not sure am I wrong to understand guides previously mention in my post or those guides missing to mention that action should be taken on micro:bit too, to be able to read temp, change display, etc.
I will appreciate your help.

I got this micro:bit unit few days ago and I try to use it for teaching purpose.

What should be running on micro:bit for other extension command to be used?


Thanks,
 Damir

Evan Patton

unread,
Sep 1, 2017, 12:15:05 PM9/1/17
to MIT App Inventor Forum
Hello Damir,

Our tutorials assume that the original programming of the device is intact. If you are loading a custom program onto the micro:bit, e.g. developed using the PXT editor, then you will need to enable the services you wish to use.

Evan

MicroIC

unread,
Sep 1, 2017, 3:11:53 PM9/1/17
to MIT App Inventor Forum
Hi Evan,

this is strange, because I try immediately after I flash unit with new firmware ver.  which was 0241, and it was not working with MICROBIT extensions, but also I try with new ver. 0243, result is same as before.

So, now is working only if I have bluetooth service enabled in  MICROBIT, but there is also question how to start more services at once, for instance if I wish to have temperature and accelerometer. I notice that led matrix, show something when both of those services are active.


Thanks for your help.
Regards,
Damir




MicroIC

unread,
Sep 3, 2017, 12:10:16 PM9/3/17
to MIT App Inventor Forum
Hi Evan,

Now I am clear that MICROBIT Bluetooth should be set for NOT PAIR to be able to work with any device connected to it, without MICRO:BIT flash to be upload to unit first.
If Bluetooth is set for PAIRING than my MICROBIT not working without Bluetooth block programmed to it first.

Now I know how to star with it, and that is OK, I can live with it.

In addition I have question about Microbit_Uart1 extension.
Is there any way have a block with auto parsing if terminated string is received, as well as micro:bit have bluetooth on data receive with type of termination to be chosen.

here it is small motion alarm I work on with AI and micro:bit, but every time I press disconnect button AI crash without error captioned in notify.

I will appreciate any help.
Thanks,
Damir
 
MICRO_BIT_ALARM.aia
microbit-MICRO_BIT_ALARM_PHONE.hex

Evan Patton

unread,
Sep 5, 2017, 10:39:24 AM9/5/17
to MIT App Inventor Forum
Hi Damir,

If you have the micro:bit configured for pairing (this is on in the stock hex file from the micro:bit foundation) then you need to first pair it with your phone before you can connect to it using any of our example programs. Pairing is recommended for security reasons because it establishes encryption of messages between the two devices.

Regarding the issue of a line terminator for the BLE extension and related, one challenge there is the timing of everything. Packets between BLE devices are typically 23 bytes, so if one sends a string longer than that the devices need to be synchronized in some way to ensure that the receiving device doesn't miss a packet (cf. TCP vs. UDP). Such a solution may also not be portable to other devices, which complicates things further.

I took a look at your AIA file, and I think the issue that is causing your crash is that you have a timer that is requesting updates every 100 ms. When you disconnect, you are turning off the timer and disconnecting the device, but this does not happen instantaneously, so you end up issuing a request that doesn't happen until after disconnect. This results in a crash. You should only need to request updates on connecting the device once, for example in the BluetoothLE1.Connected event handler.

Evan

Reply all
Reply to author
Forward
0 new messages