Microbit start
I have a microbit laying around since forever.
As my first program I wanted a dice rolling using not numbers but images from an array. To compile the program to a .hex file and upload to the microbit I used: makecode.
The program code:
input.onButtonPressed(Button.A, function () { dice_num = Math.randomRange(0, 5) dice[dice_num].showImage(0) }) let dice_num = 0 let dice = [images.createImage(` . . . . . . . . . . . . # . . . . . . . . . . . . `), images.createImage(` . . . . . . # . . . . . . . . . . . # . . . . . . `), images.createImage(` . . . . . . # . . . . . # . . . . . # . . . . . . `), images.createImage(` . . . . . . # . # . . . . . . . # . # . . . . . . `), images.createImage(` . . . . . . # . # . . . # . . . # . # . . . . . . `), images.createImage(` . . . . . . # . # . . # . # . . # . # . . . . . . `)] basic.showLeds(` . . # . . . # # . . # # # # # . # # . . . . # . . `)
On start the microbit shows an arrow that gives you the hint to press button A.
Pressing button A shows a random dice image from an array.
Not the most beautiful code. But it works and it was a good feeling to see it running and this small computer.