# Microbit V2 audio module is missing?

**URL:** https://forum.makecode.com/t/microbit-v2-audio-module-is-missing/10008
**Category:** micro:bit
**Created:** [September 13, 2021, 6:38pm UTC](https://forum.makecode.com/t/microbit-v2-audio-module-is-missing/10008 "2021-09-13T18:38:05Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![erkman](https://avatars.discourse-cdn.com/v4/letter/e/ce7236/32.png) [@erkman](https://forum.makecode.com/u/erkman)
#### Post date: [September 13, 2021, 6:38pm UTC](https://forum.makecode.com/t/microbit-v2-audio-module-is-missing/10008/1 "2021-09-13T18:38:05Z")

</div>

Hi there,

I’ve got a question, regarding this documentaton:  
[https://microbit-micropython.readthedocs.io/en/v1.0.1/audio.html](https://microbit-micropython.readthedocs.io/en/v1.0.1/audio.html)

In my Microsoft MakeCode Editor it marks me audio as red, because it cannot find any such module, also not in the extensions.

So, this Microsoft gadget is uncomplete, or the documentation is not for the v2?

I would like to use microbit’s own built in speaker. (you can also write an example to use it).

Thanks is advance for your help

---

<div class="post-metadata">

### Author: ![bsiever](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bsiever/32/1032_2.png) [@bsiever](https://forum.makecode.com/u/bsiever)
#### Post date: [September 14, 2021, 3:58pm UTC](https://forum.makecode.com/t/microbit-v2-audio-module-is-missing/10008/2 "2021-09-14T15:58:18Z")

</div>

There are two different versions of python for the Micro:bit:

- MicroPython, which is what that documentation is from. To use the MicroPython version go to: [https://python.microbit.org/v/2](https://python.microbit.org/v/2) (Not MakeCode)
- MakeCode’s version, which supports different features and has different functions/methods that aren’t usually compatible with the MicroPython version (That is, MakeCode has a different [API](https://en.wikipedia.org/wiki/API)). MakeCode’s documentation is at [Reference](https://makecode.microbit.org/reference). If you click on a palette (like `Basic`) and then click on each command (like `showNumer`) you can see the three different types of support for the concept: Block-based, JavaScript, and MakeCode’s Python.

For more details on MakeCode’s Python vs. MicroPython see: [MakeCode Python and MicroPython](https://support.microbit.org/support/solutions/articles/19000111744-makecode-python-and-micropython)

Bill

---

<div class="post-metadata">

### Author: ![Primal\_Nexus](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/primal_nexus/32/3540_2.png) [@Primal\_Nexus](https://forum.makecode.com/u/Primal_Nexus)
#### Post date: [September 14, 2021, 5:47pm UTC](https://forum.makecode.com/t/microbit-v2-audio-module-is-missing/10008/3 "2021-09-14T17:47:03Z")

</div>

@erkman, there is a simple way to do this with the Micro:bit, and it’s in the `Music` Section. The MakeCode Micro:bit Python code will be listed below too.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/b/bed0ffe0b8afa524b54829afc0365ed33dd5dab8.png)  
Open up your MakeCode editor  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/9/9dc8270c6a72564ddf83f310f48c05e75e00fd86.png)  
open up the `Music` section  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/2/2f50860a23d6e8f4206884b771a12d1a2a2f3aa0.png)  
Scroll all the way down the `Music` section till you reach the `micro:bit (V2)` sign  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/8/828614c67a47cee001be56c534add17e6d3aaf8e.png)  
Attach a `set built-in speaker <ON/OFF>` block to your `on start` or `forever` block and set it to `<ON>`  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/9/915dd7fd1aecbb8b0e7c218f1ceb764394578f87.png)  
Then attach any music making block and do whatever you want! If you upload this to the Micro:bit V2 it should play the sounds you coded it to run.

The next part is the same code but in the MakeCode Micro:bit Python Editor (you’ll probably find this more useful, since you’re using MicroPython, but just in case other people with this issue come to this post and want the block solution, it’s there for them):

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/3/3cbb91a4b1f12637beb1c85aed3b3bee54ece1ee.png)  
My code, you can use something different if you want.

Hope this helped 🙂

---

<div class="post-metadata">

### Author: ![erkman](https://avatars.discourse-cdn.com/v4/letter/e/ce7236/32.png) [@erkman](https://forum.makecode.com/u/erkman)
#### Post date: [September 15, 2021, 8:24pm UTC](https://forum.makecode.com/t/microbit-v2-audio-module-is-missing/10008/4 "2021-09-15T20:24:00Z")

</div>

Hi Guys.  
Thank you for the information.  
This is a lettle pretty sad that the modules are not compatible which each other’s platforms:  
For e.x. Bluetooth modul is working for communication through pc via bluezero (I use Ubuntu server 20) only via the for education based makecode website but there is NO split command that works or there is not any break command to break out of any loop.

Another thing:  
You have to choose useage between extensions. Ex. Bluetooth or Datetime. If you use them booth in the same script you get an error code of 071 (this code is not doxumented any where).

Yes, I know this gadget is more for education but I thought before using a microcontroller this would be a good entry.  
Now I see it is very limited.

---

<div class="post-metadata">

### Author: ![Primal\_Nexus](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/primal_nexus/32/3540_2.png) [@Primal\_Nexus](https://forum.makecode.com/u/Primal_Nexus)
#### Post date: [September 16, 2021, 4:48pm UTC](https://forum.makecode.com/t/microbit-v2-audio-module-is-missing/10008/5 "2021-09-16T16:48:02Z")

</div>

> [@erkman](#):
>
> Now I see it is very limited.

Yep @erkman, as you said, the Micro:bit is designed for learning to code with a pre-set microcontroller, maybe consider the Raspberry Pi?

---

<div class="post-metadata">

### Author: ![erkman](https://avatars.discourse-cdn.com/v4/letter/e/ce7236/32.png) [@erkman](https://forum.makecode.com/u/erkman)
#### Post date: [September 16, 2021, 9:05pm UTC](https://forum.makecode.com/t/microbit-v2-audio-module-is-missing/10008/6 "2021-09-16T21:05:14Z")

</div>

Hi, Yes, I’ve already have a Raspy, my Ubuntu Server is running there, and for me set up a server is much easier than it was for Microbit. But Im an experienced, finally, I got it work, so I see now my server important paramters on the Microbit Screen, with mani warnings (accustic also). So what I have done with Microbit:  
My server refresh with its data every minute (there is a cronjob for that):  
The microbit shows me server time, there is an alarm clock, show server CPU temp, load and 1-2 extra thing which I can see next to my bed without using the smartphone 🙂

The built in speaker is good for acustic notifications for that purpose (scripted in microbit the thresholds for watching) my server is within bluetooth range. Bonus: at night the leds are dimmed automacially adjusted to the months…So my microbit isn’t a toy anymore 🙂

---

<div class="post-metadata">

### Author: ![bsiever](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bsiever/32/1032_2.png) [@bsiever](https://forum.makecode.com/u/bsiever)
#### Post date: [September 17, 2021, 3:20pm UTC](https://forum.makecode.com/t/microbit-v2-audio-module-is-missing/10008/7 "2021-09-17T15:20:15Z")

</div>

@Erkman Your project sounds really cool and I hope you share more details here (maybe create an instructable and/or a video showing it off)!

Some background and updates on what you’ve experienced:

MicroPython, which is a “true” python, uses too much memory to support bluetooth on the V1 microbit. It sounds like [work is underway to add bluetooth support to the V2](https://microbit-micropython.readthedocs.io/en/v2-docs/ble.html).

MakeCode translates code to [native ARM instructions](https://www.microsoft.com/en-us/research/publication/static-typescript/), which leaves enough space for Bluetooth (but just barely enough on the V1). MakeCode chose to use an API that was consistent among the three languages they support (blocks, static TypeScript, and Python). That seems like a reasonable choice to me. I prefer the event handling approach used by MakeCode’s API.

I’m not sure what you mean about `break` and `split`. It looks like you can `break` out of loops in MakeCode and strings do support `.split()`.

A few details about the `datetime` module (assuming you’re referring to microbit-pxt-datetime):

- It was developed before the V2 existed. There wasn’t enough memory for both `datetime` and `bluetooth` on the V1, so using both led to memory errors ([020](https://support.microbit.org/support/solutions/articles/19000016969-micro-bit-error-codes)).

- It was developed for some specific applications and `bluetooth` wasn’t an important feature, although `radio` was. You can use serial, `radio`, and two micro:bits to “relay” messages without bluetooth. See the [Remote Data Collection](https://makecode.microbit.org/device/data-analysis/remote) example. That approach would work with both the V1 and V2.

- This is an open source project that the developer (me) does in free time. As with all open source/free projects, there may be imperfections. Other developers are welcome to contribute patches and users are encouraged to share details about problems with the developer(s).

- I’ve now updated the code to avoid the 071 (CPU Fault) error:

---

<div class="post-metadata">

### Author: ![erkman](https://avatars.discourse-cdn.com/v4/letter/e/ce7236/32.png) [@erkman](https://forum.makecode.com/u/erkman)
#### Post date: [September 17, 2021, 8:32pm UTC](https://forum.makecode.com/t/microbit-v2-audio-module-is-missing/10008/8 "2021-09-17T20:32:14Z")

</div>

Hi @bsiever,

I use the V2 with bluetooth, and it works as expected with very limited funtions. (with bluetooth uart read you get the data 🙂 )

Yes I maybe I can share, but this is very specific useage of the tools I don’t know if it is interessting anybody.  
Thanks for the error code update, I thought it was something with memory because it would be more obviously if running with two modules which are incompatible (why?) with each other.

Yes, I’ve used makecode editor for the bluetooth support (micropython doesn’t have any unfortunately)

I do not know, how you tested, but if you want to import microbit-pxt-datetime and bluetooth in the same project, it seems working in the simulator, but if you deploy your code on the real microbit, then you get this 071 error code on startup, and then you have to choose, which is more important for you… ☹

Maybe there is a split command and break command in micropython (and javascipt also), but in the makecode however it does not work nor effect. I know what I say since I used to use them years ago. Maybe this is a bug, try this, nothing will happen no error codes also:  
array\_string = “1,2,3,4,5,A”  
array\_s = array\_string.split(",")  
for i in range(array\_s.length):  
basic.show\_string(array\_s[i])

Erkman

---

<div class="post-metadata">

### Author: ![bsiever](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bsiever/32/1032_2.png) [@bsiever](https://forum.makecode.com/u/bsiever)
#### Post date: [September 18, 2021, 4:05am UTC](https://forum.makecode.com/t/microbit-v2-audio-module-is-missing/10008/9 "2021-09-18T04:05:58Z")

</div>

Here’s a working example (on the V2) of the `datetime` being used with Bluetooth: [https://makecode.microbit.org/\_hHu51icChhdM](https://makecode.microbit.org/_hHu51icChhdM)

string `split` is finicky and doesn’t work well. I may be good to open an issue on the GitHub repo for [`pxt`](https://github.com/microsoft/pxt) showing your example. That being said, here’s an example that does work:

```auto
array_string = ""

def on_forever():
    global array_string
    array_string = "1,2,3,4,5,A"
    for value in array_string.split(","):
        serial.write_line("" + (value))
basic.forever(on_forever)

```

Link to example: [https://makecode.microbit.org/\_A04TAgD2V3E0](https://makecode.microbit.org/_A04TAgD2V3E0)

Bill

---

<div class="post-metadata">

### Author: ![erkman](https://avatars.discourse-cdn.com/v4/letter/e/ce7236/32.png) [@erkman](https://forum.makecode.com/u/erkman)
#### Post date: [September 27, 2021, 7:20pm UTC](https://forum.makecode.com/t/microbit-v2-audio-module-is-missing/10008/10 "2021-09-27T19:20:52Z")

</div>

Hi @bsiever  
I do not know where the issue is, but look at this:

> **[uart-read-until-with-time-errormsg](https://makecode.microbit.org/98637-31005-05418-01598)**
>
> Made with ❤️ in Microsoft MakeCode for micro:bit.

I’ve put into an existing working example your microbit-pxt-timeanddate extension…  
now I get the compile error:

“The hex file is not available, please connect to internet and try again.”

In booth codeeditors: online and Win installed offline version.

So there is something more then a little bug… I saw your example, but please look at my example, and tell me, what went wrong only by include (!) the extension (In the code I did not make any changes).

Thanks,  
Janos

---

<div class="post-metadata">

### Author: ![bsiever](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bsiever/32/1032_2.png) [@bsiever](https://forum.makecode.com/u/bsiever)
#### Post date: [September 28, 2021, 8:27pm UTC](https://forum.makecode.com/t/microbit-v2-audio-module-is-missing/10008/11 "2021-09-28T20:27:19Z")

</div>

I’m not exactly sure what’s going on, but here are some things of interest:

- It looks like the backend compiler is timing out. It eventually reports “abandoning C++ build”. (Anyone familiar with the backend compiler??? Any idea what may be going on? Here’s a project that contains just `Bluetooth` and another extension with C++ (date-and-time): [https://makecode.microbit.org/\_A5HDvR1P77Mc](https://makecode.microbit.org/_A5HDvR1P77Mc) )
- The time-and-date extension uses C++ code, which uses a backend compiler. I don’t think it’s accessible in the offline version of MakeCode.
- Something is a little wrong with your project, but it’s not the cause of this error. `Bluetooth` and `Radio` should be mutually exclusive, but your project seems to include both. Normally when you add `Bluetooth` the `Radio` blocks are removed.

Sorry I don’t have any immediate solutions. I’ll try to provide more of an update when I have a better understanding of the issue. I think either the compiler is timing out too quickly or there is some unusual compilation problem.

Bill

---

<div class="post-metadata">

### Author: ![bsiever](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bsiever/32/1032_2.png) [@bsiever](https://forum.makecode.com/u/bsiever)
#### Post date: [September 29, 2021, 3:21pm UTC](https://forum.makecode.com/t/microbit-v2-audio-module-is-missing/10008/12 "2021-09-29T15:21:29Z")

</div>

@erkman I’m not sure what’s changed, but it appears to work fine now. I just:

1. Created a new project.
2. Added the `Bluetooth` extension
3. Added the `Time and Date` extension
4. Pasted in the JavaScript version of code you created
5. Hit Download and it worked

Everything appeared to work.

After that I updated the code to ensure the time was usable and to change how some things are being done. My updated version seems ok on a v2 micro:bit (v1 doesn’t have enough memory for it to run correctly). Here it is: [https://makecode.microbit.org/\_4k01JmPXfU3s](https://makecode.microbit.org/_4k01JmPXfU3s)

Bill

---

<div class="post-metadata">

### Author: ![erkman](https://avatars.discourse-cdn.com/v4/letter/e/ce7236/32.png) [@erkman](https://forum.makecode.com/u/erkman)
#### Post date: [September 29, 2021, 8:35pm UTC](https://forum.makecode.com/t/microbit-v2-audio-module-is-missing/10008/13 "2021-09-29T20:35:34Z")

</div>

Hi @bsiever,

I have a V2.  
may be interpreting python code is a problem? Next issue I faced today (there is a github msg for that also): I fed up with the software rtc so I bought a kitronic klimate board which has real rtc module, fitting for me (not the extra costs), so I set it up, worked like a charm, but next error: import this extension with bluetooth, now I had remaing approx 260 lines of code (!) The thruth was, I had already pre-code more then 300 lines of code (yes, only remainging bytes are shown in the error msg, so I tried to figure out how many code can be pleaced in the script… and then compacting shorting variables, remove unnececary but nice to have gadgets in the code itself.  
So that’s all, but now, I re focus on my microcontroller boards, in the meantime I’ve succcessfully set up a TTO T-Call ESP32 with PIR motion alarm. I rather say that one was much easier than microbit.

Yes, I accept, this is more a learning tool for kids between 6-12, but the bluetooth feature was to impressive, I cannot withstand to try out, but reached the limits very fast.  
But V2 should have more abilities then V1., combine the extensions should be possible without any issues I think and not causing memory, or any problems. (or the basic concept and kernel is not finetuned).

Now the Microbit does it’s work, but I won’t say, I’ve planned that it consume so much time.  
Thank you for your help and care, the future generation needs this 🙂
