Coding for the micro:bit
Coding for the micro:bit
Use the MakeCode Platform: Go to https://makecode.microbit.org/ to write your programs.
Built-in Simulator: MakeCode includes a virtual micro:bit simulator that displays the results of your program on screen.
Use the code editor to build your program by dragging and dropping code blocks. Test and run your program on the simulator, as shown in the diagram below.
Sending the Program to the micro:bit:
Download the File: After finishing your code, click the "Download" button or the Save button with the disk icon 💾
A .hex file will be downloaded to the "Downloads" folder on your computer
Before transferring your program to the micro:bit, you need to connect the micro:bit to the computer first.
Step 1
Connect the micro:bit to the computer using a micro-USB cable:
On your computer, the micro:bit will appear as a drive named "MICROBIT".
(Note: Keep in mind that it is not a regular USB flash drive.)
⚠️ Note:
Pay attention to the direction of the micro:bit port and align it correctly with the USB cable plug.
Do not use excessive force when disconnecting the micro:bit and the USB cable.
Step 2
Copy the downloaded .hex file to the micro:bit:
You can drag and drop the file into the "MICROBIT" drive, just like copying a file to a USB flash drive.
On Windows, you can also right-click the file and select "Send to → MICROBIT".
Step 3
Wait for the program to transfer:
While the code is downloading (flashing) to the micro:bit, the board will temporarily pause, and the yellow LED light on the back will flash.
Wait patiently for the flashing to stop. Once finished, your program will run automatically.
⚠️ Note:
After programming is complete, the "MICROBIT" drive will automatically refresh/reconnect on your computer.
The micro:bit can only process .hex files and will not store any other file types.
The micro:bit is a micro-computer, it requires power to operate.
USB Power: By connecting the micro:bit to a computer using a USB cable, it receives power directly from the computer's USB port.