Software › Music: Melody + Heart
Music: Melody + Heart
An original CC0 bare-metal micro:bit V2 program written for emulators.org and compiled with arm-none-eabi-gcc for the ARM Cortex-M4. It plays "Twinkle, Twinkle, Little Star" (traditional melody, public domain) on the on-board speaker by programming the real nRF52 PWM peripheral (PWM0 on P0.00): for each note it sets COUNTERTOP = 1 MHz / note-frequency with a 50%-duty sample, so the speaker emits a square wave at the note pitch — exactly how the real board plays tones. Between notes it scans a heart / musical-note picture across the real 5x5 matrix. This is the v2 upgrade over v1: it makes real, time-varying SOUND. Unmute with the Sound button.
Format: nRF52 flash image (bare-metal, compiled C) · By: emulators.org · Licence: Public domain (CC0); melody traditional (public domain)