I just picked up a micro:bit, the little educational microprocessor board originally from the BBC. It’s a nice little unit, though like all educational resources, it’s sometimes hard to access resources as a non-edu type.
I landed upon MicroPython, a Python language subset that runs directly on the micro:bit’s ARM chip. I rather like the Mu editor:
To give the old microcontroller grumps something real to complain about, MicroPython includes a bunch of very high-level functions, such as a powerful music and sound module. Getting the sound out is easy: just croc-clip a speaker onto the output pads:
(MicroPython warns against using a piezo buzzer as a speaker, but mine worked fine â€” loudly and supremely annoyingly â€” with a large piezo element. Some piezos have a fixed-frequency oscillator attached, but this simple one was great.)
This trivial example plays the Nyan Cat theme forever, but every time it loops it gets faster. The beats variable starts at the default 120 bpm, but is increased by one every time:
# nyan but it gets faster import music beats = 120 while True: music.set_tempo(bpm=beats) music.play(music.NYAN) beats = beats + 1
This starts out as merely irritating, but quite quickly becomes deeply annoying, and in mere hours become vastly vexing. I’m sure you’d only use this power for good â€¦
How did you make micro:bit in Fritzing?
Pretty sure I used this: topshed/FritzingParts