Sending BLE message from microbit

Hi!

I’ve been looking at the voice activated microbit example, and I think it should work well for something I want to do.

I want to use the microbit to detect a sound, and when the sound is detected, activate the microbit’s speaker and send a message using BLE.

Any tips of where in the microbit example code to look, and which changes to make to realize this solution?

All help is greatly appreciated! Thanks!

Hi @mathias take a look at the other examples in that repository (not by us, but by the microbit team):

  1. https://github.com/edgeimpulse/voice-activated-microbit/blob/56e0158b675ef71cd9de847d78d0de0de1a11045/source/SpeakerTest.cpp#L619 - playing something over the speaker.
  2. https://makecode.microbit.org/reference/bluetooth - Driving the radio.

Knowing the microbit a little you can probably just combine these APIs, so at the place where we display the smiley just throw the speaker code in and try if it works.

Thanks, @janjongboom!

I’ll check it out.

@janjongboom, do you know if it is possible (or how to make it possible) to build and flash the voice activated microbit example using west instead of the python build file?

I currently have a bluetooth UART example that works on the microbit, but as the two examples build and flash in two different ways I’m very unsure of how to merge them.

Hi @mathias, not as far as I know as it’s not based on Zephyr, but on Codal instead. Maybe https://github.com/lancaster-university/codal-microbit-v2 is a better place for this, I’ve only done the porting of the microphone code.

I understand. Thank you for your reply, @janjongboom! :slight_smile: