Contrlling RGBLEDs connected to BBC microbit V2 with Mit App Inventor

Helllo once again.

I am trying to create an app to control RGB LEDs connected to the micro:bit.

From the codes, the instructions for the micro:bit to connect to the Mit Campanion worked with the micro:bit.

But when I click on the buttons created to switch the RGD LEDs on the app it does work.

The images show the design of the app and the code. I have also uploaded the coded for the micro:bit.

Can anyone help me figure out where the problem is?

Thank you.





The app of App Inventor uses the Io Pin Service.
I think the makecode is the follow.

mk

1 Like

Which microbit extension are you using?
Probably it is much better to send commands via UART, interpret these on your microbit and set the io-pins using makecode on your microbit.
See here: The Internet of Things: Data Acquisition and Analysis for a tutorial.

1 Like

Oh okay, Let me try that and see.

Thank you very much.

Hello Ghica.

I am actually using the Bluetooth extension.

Of course you are using a bluetooth extension, but my question was, which one.
Actually it does not matter because you cannot address the io-pins this way, because all microbit extensions are flawed. You can only successfully use UART, read my previous post again. try the tutorials I pointed to, and then try your IOpins again.

1 Like

Alright, Ghica, Thank you very much.

I will try it and give you feedback.

Maybe I should have givne a bit more explanation. I have a tutorial about communicating with a microbit:

And the link to the internet of things tutorial I gave earlier (https://appinventor.mit.edu/explore/ai2/IoT_unit) has a more gentle explanation.
Except for the BLE extension mentioned in the Internet of things tutorial, you should use this one edu.mit.appinventor.ble-20230223-beta.aix (200.0 KB) mentioned in my tutorial, to get the proper Android permissions.

At this moment you cannot address the IO-pins of the microbit directly from App Inventor, as I said. So, what you should do instead is send a command to the microbit via the serial interface UART, the microbit recieves this command and activates the IO-pins, using MakeCode. All explained very well in the IOT tutorials.
The last example in these tutorials is about watering plants, I think also do via the IO pins, so that should help you.

1 Like

Thank you very much @Ghica

My setup is working now :grinning:

Great!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.