Flash your BBC micro:bit via USB
Once you're happy with your program in the code editor, the next step is to connect the device, compile and send the program to your BBC micro:bit and watch your masterpiece come to life!
To send the program via the USB connection, you'll need the following things:
- A Male-to-Micro USB cable to connect your computer to your micro:bit.This is the same cable that is commonly used to connect a smart phone to a computer (make sure that it can transfer data as well as power).
- A Computer running Windows 7 or later, Mac OS X 10.6 or later or Linux
- Access to the Internet
Step 1: Connect your BBC micro:bit to your computer
- חבר את הקצה הקטן של כבל ה-USB ליציאת USB על המיקרוביט שלך.
- חבר את הקצה השני של כבל ה-USB ליציאת USB במחשב שלך.
Your computer should recognise your micro:bit as a new drive.
On computers running Windows, MICROBIT appears as a drive under Devices and drives.
On a Mac it appears as a new drive under Devices.
Step 2: Compile your program
Using the editor of your choice, select Download. If prompted, choose to save the compiled file on your computer (or anywhere other than the BBC micro:bit).
Select Download. When asked what to do with this file, select Save and it will be saved to your downloads folder. Selecting Open Folder will allow you to view your downloads
When you select Download in Safari, your file will apppear under downloads in the top right of the screen, you can open your downloads folder from here. Note that a bug in Safari prevents the .hex download, so you may need to rename your file with a the .hex suffix.
This is the same process on Windows and Mac. Select Download and your .hex file will appear as a download at the bottom of the browser.
Right click on the download and select show in folder.
Step 3: Flash the file to your BBC micro:bit
The process of transferring the .HEX file to the BBC micro:bit is called flashing. To flash the file, simply drag and drop it on to the micro:bit drive from the file explorer or finder window. Here's the process on Windows
- The LED on the back of your BBC micro:bit flashes during the transfer (which should only take a few seconds).
- Once transferred, the code will run automatically on your BBC micro:bit. To rerun your program, press the reset button on the back of your BBC micro:bit. The reset button automatically runs the newest file on the BBC micro:bit.
- By copying the program onto the 'MICROBIT' drive, you have programmed it into the flash memory on the micro:bit, which means even after you unplug the micro:bit, your program will still run if the micro:bit is powered by battery.
You can’t drag and drop more than one hex file at once onto your micro:bit. If you try to drag and drop a second hex file onto your micro:bit before the first file has finished downloading, then the second file may fail in different ways.
When the first program has been written to the micro:bit, the drive will eject. If you drag and drop a second file at this point it may not find the drive and the second write will fail.
The errors may look like this:
Or it may appear that there are two hex files on your BBC micro:bit so the micro:bit won’t be able to run multiple files. To rectify this, unplug your micro:bit and plug it in again. Make sure that your micro:bit appears as a MICROBIT drive and not MAINTENANCE.
For more information check out our Knowledgebase