Microbit UART

339 views
Skip to first unread message

yeseong Bae

unread,
Aug 12, 2018, 2:58:55 AM8/12/18
to MIT App Inventor Forum
Hi
I'm trying to receive data from microbit by using app inventor's bluetooth LE extension.
But when I try to get data with bluetooth, it causes an error.
I used microbit's bluetooth uart to send data(analog pin data)
I attached my app inventor and microbit code below.
please help me// 
block.png
blockm.png

gerrikoio

unread,
Aug 14, 2018, 11:01:35 AM8/14/18
to MIT App Inventor Forum
What is the error message? Need this to help you.

Note that there is no real need to use both RegisterForFloats and ReadFloats blocks.

The RegisterForFloats is only called once to enable App Inventor to trigger the "when FloatsReceived" block everytime data arrives.

The ReadFloats block, on the other hand, has to be called each time to you want to read any data that is available to be read.

LG twins fan

unread,
Aug 15, 2018, 9:54:12 AM8/15/18
to MIT App Inventor Forum
The error messeage was "Error: 3300"
Thanks
Screenshot_20180815-225146.png

gerrikoio

unread,
Aug 16, 2018, 8:56:59 AM8/16/18
to MIT App Inventor Forum
Thanks. Unfortunately, I don't know what a 3300 error code means. Maybe someone else can help.

For info, how are you capturing this error?

As in, are you using the "when Screen1.ErrorOccurred" block to capture this error code.

If you are not using, please can you insert this block into your code and then you can also capture the error message.


yamafu

unread,
Aug 16, 2018, 9:40:13 AM8/16/18
to MIT App Inventor Forum
Hi,

I am not sure the error message, but
I would be happy if the following article could help you.


FoYo

LG twins fan

unread,
Aug 17, 2018, 3:40:32 AM8/17/18
to MIT App Inventor Forum
I tried it again with the screenerror block, and it says the Uuid was wrong.
Please help me//
Screenshot_20180817-163803.png

gerrikoio

unread,
Aug 17, 2018, 6:06:09 AM8/17/18
to MIT App Inventor Forum

Capture.JPG


The service UUID looks correct to me, but I suspect you need to include the dashes, as in 6E400001-B5A3- etc.


Also, it might be worth checking your characteristic UUID. Usually, the 6E400002- is used for the write... methods (even though it says in the text description RX Characteristic).


With my microbit, I need to use 6E400003- to receive data and only the "RegisterFor..." methods work, and not the "Read..." method, as the properties for this characteristic is "notify" only.




LG twins fan

unread,
Aug 17, 2018, 10:35:14 AM8/17/18
to MIT App Inventor Forum
I included the dashes and changed the characteristicnUuid to 6E400003-B5A3 etc but it says the Uuid is not pulbished by the connected device
Please help me//
Screenshot_20180817-233130.png

gerrikoio

unread,
Aug 17, 2018, 5:11:06 PM8/17/18
to MIT App Inventor Forum
It is case sensitive so check.

gerrikoio

unread,
Aug 17, 2018, 5:22:26 PM8/17/18
to mitappinv...@googlegroups.com
Also, use a BLE utility app such as Nordic "nRF Connect" app to check your microbit UUID's. It is free to download from the Play Store.

To use, simply scan for your microbit. Then connect. This will then show you all the registered GATT services. Click on the right one and it will then highlight the Characteristics.

You can then confirm that the UUID's match what you are using in your App.

Evan Patton

unread,
Aug 17, 2018, 5:23:37 PM8/17/18
to MIT App Inventor Forum
@gerrikoio I remember this being a problem in the older versions of the BLE extension, but the newer one should be able to handle UUIDs regardless of case. In which version are you seeing the case sensitive behavior?

Cheers,
Evan

LG twins fan

unread,
Aug 18, 2018, 3:49:12 AM8/18/18
to mitappinv...@googlegroups.com
I matched the Uuids using Nordic nRF Connect.
It doesn't cause error but still I can't recieve microbit's values.
What is the problem??
Help me//
Is the value too small to show?(0.00028)
Screenshot_20180818-164203.png
Screenshot_20180818-164451.png

gerrikoio

unread,
Aug 18, 2018, 5:09:54 AM8/18/18
to mitappinv...@googlegroups.com
@ewpatton thanks for pointing out that case sensitivity no longer applies. 

Ok, I see that in your case the Characteristic uuid to receive data is 6400002 and not 6400003. Also, I see that this characteristic is using an "indicate" method, which has slightly different behaviour to the read and notify properties. I have not tested this option myself as most ble examples I've come across use the "read" or "notify" options.

@ewpatton is this option handled by the BLE extension?

So, in your case, as you noted that you thought maybe the values were too small. Well, a simple way to test this is to insert a Notifier block into your code and then if you are using the "when FloatsReceived" method is trigger display a notifier alert. This visual method will then tell you that your app is at least receiving something and your assumption was valid. You could then resolve by using a 10x multiplier for example and do the reverse on the other end.

Now, if this method is not being triggered then, assuming you used the "RegisterForFloats" method, you will need to try the "ReadFloats" option. Note that for "ReadFloats" if you want to periodically check if a value is available to read, then you need to use a clock timer function.

If neither work that you need to look at your microbit code and add in a "notify" or "read" property.


LG twins fan

unread,
Aug 18, 2018, 6:50:19 AM8/18/18
to MIT App Inventor Forum
Thanks for answering!!!!
Finally I received the value using Microbit UART Extension.
Thank you very much for helping!
Screenshot_20180818-194544 (1).png
Reply all
Reply to author
Forward
0 new messages