Amp:bit code incomprehensibly


#1

I bought the bit:amp and there is an example for python, but it’s really incomprehensibly…
Can somebody explain and give some more details? Her is the description:

This is an example program to play an audio sample on the micro bit,
the samples are restricted in length and quality by the memory limitations
of the micro bit.

To upload to your micro bit :

Open Mu (if you don’t have it, get it here : https://codewith.mu/)
create a blank file
upload the blank file to the micro bit (This allows us to use the file manager)
Copy the contents of this directory to the Mu data folder (save your empty python script and search for it)

Connect a speaker between pin 0 and gnd, or use one of amp bits for a real oomph!

When the upload has finished, reset your micro bit, and you should hear a short sample.

Thanks a lot.


#2

Having a look at it, but for now, if you just want to test that your amp:bit works, attach it to the micro:bit, and go to https://makecode.microbit.org/ and use the blocks to go
on start - start melody prelude - repeating once, upload to your microbit and hopefully you should get an annoying tune out of it.

If you want to test using micropython, download the Mu editor. You can get Windows, OSX and Linux versions, so pick one for the computer you’re connecting your micro:bit to. Mu is available at https://codewith.mu/.
Open a new file and paste this in to replace all of the examples:

from microbit import *
import music

music.play(music.PRELUDE)

press flash to load it onto the microbit.

Two ways of doing the same annoying tune, woo!


#3

First, did you checked that Mu/micropython/micro:bit was in good shape?
You may have issues with uflash or the micro:bit itself.

May I suggest you try a simple Hello World to verify this?

from microbit import *
display.scroll("Hello, World!")

Next double check you have the latest Mu version.
You could also try with the online http://python.microbit.org/


#4

Thanks,
Mu itself works amp:bit works, flashing also is ok, but I just don’t understand the following:
“create a blank file
upload the blank file to the micro bit (This allows us to use the file manager)
Copy the contents of this directory to the Mu data folder (save your empty python script and search for it)” ???