App with the microbit button extension crashes

370 views
Skip to first unread message
Assigned to nis...@cavedu.com by farzeen....@gmail.com

Paul Koning

unread,
Jan 22, 2018, 2:08:55 PM1/22/18
to MIT App Inventor Forum
Hello everybody,

I'm using Appinventor2 with the bluetooth and micro:bit extensions to connect my smarthpone with a micro:bit.
I made the basic connection app and this works fine. The I made a simple app to read the temperature from the micro:bit and that worked fine too.

Now I've made an app to read a button state form the microbit but when I run it, it crashes... I've got no idea why this happens. But is is the 'Call Microbit_button1.ReadButtonAState' that makes it crash.

My micro:bit program is very simple and it requires no pairing:



And this is my AppInventor program:

What is it that goes wrong here? Thanks for the help!

Kind regards,
Paul Koning

Kelvin Lee

unread,
Jan 25, 2018, 10:09:05 AM1/25/18
to MIT App Inventor Forum
I have same problem but when I connect the Bluetooth and call the Microbit.RequestTemperatureUpdates.

SteveJG

unread,
Jan 25, 2018, 10:14:53 AM1/25/18
to MIT App Inventor Forum
I am guessing that is a problem with your version of the extension.  The extension may have been updated to be compatible with nb166 and you are using an older version?
Check to see if there is a newer version than you are using  Micro:bit extension: http://iot.appinventor.mit.edu/assets/resources/com.bbc.microbit.profile.aix  and try that.

Regards,
Steve

Paul Koning

unread,
Jan 25, 2018, 10:55:11 AM1/25/18
to mitappinv...@googlegroups.com

Hi Kelvin,


It is strange, the temperature extension works fine with me when I use the following code:





Kind regards,
Paul

Paul Koning

unread,
Jan 25, 2018, 11:02:23 AM1/25/18
to MIT App Inventor Forum
Hello Steve,

Thanks for helping.  I removed my old extension and added yours in App Inventor but the problem is still there.

Kind regards,
Paul

Farzeen Harunani

unread,
Jan 25, 2018, 12:28:28 PM1/25/18
to MIT App Inventor Forum
Hi,
This is a known problem that has been fixed in a newer version of the extension; however, it looks like the version on the site (the link Steve provided) is not the most updated version. For now, use this extension and let me know if it works. 
Farzeen
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

Paul Koning

unread,
Jan 25, 2018, 1:11:17 PM1/25/18
to MIT App Inventor Forum
Hello Farzeen,

Thanks for helping.

I removed the extension and added yours but it still keeps crashing when I use the block 'Call Microbit_Button1.ReadButtonAState'
When I use the block 'Call Microbit_Button1.RequestButtonAStatusUpdates' the app will crash at the moment that I press button A (that is when the status update is received

I even compeltely made the app from scratch to be sure but still the error occurs ;-(

Can I download an example somewhere that works? 

Kind regards,
Paul

Btw, when I removed the new extension after testing I received errors from App Inventor:

Technical Data to be Submitted:

notes = Browser: Mozilla/5.0 (X11; CrOS x86_64 10032.86.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.140 Safari/537.36
foundIn = nb166
faultData = com.google.gwt.event.shared.UmbrellaException: Exception caught: (TypeError) : Cannot read property 'Wc' of undefined
projectId = 5511431890010112

Message has been deleted
Message has been deleted

Paul Koning

unread,
Jan 25, 2018, 1:18:09 PM1/25/18
to MIT App Inventor Forum
I would like to post my App Inventor and Micro:bit files as an example but the posts are not accepted. Is this a security issue?

Kind regards,
Paul
Message has been deleted
Message has been deleted

SteveJG

unread,
Jan 25, 2018, 1:25:20 PM1/25/18
to MIT App Inventor Forum
@ Paul.    If an App Inventor aia file contains an extension that has compiled Java code as part of the extension, Google blocks that aia file from posting.

-- Steve
Message has been deleted

Paul Koning

unread,
Jan 26, 2018, 1:21:54 PM1/26/18
to MIT App Inventor Forum
Hello Farzeen,

I just send an e-mail with my example files. Thanks for helping!

Kind regards,
Paul Koning

Paul Koning

unread,
Jan 27, 2018, 9:29:21 AM1/27/18
to mitappinv...@googlegroups.com


Problem solved!

It was not a problem with the version of the extension. The 'older' version works fine (the one that can be found here: http://iot.appinventor.mit.edu/assets/com.bbc.microbit.profile.aix)
I found a working example at GitHub and first I could not find out what was different. But the I saw that this app had the 'complete' micro:bit extension where I only used the button extension. Looks like there is something missing if you use only the button extension. 

So now my designer view loos like this:



And my blocks for the button like this (it's the basic connection with a few extra blocks):

And this works with no problems!

Thanks for helping everybody!

Kind regards,
Paul Koning



Reply all
Reply to author
Forward
0 new messages