Ausführen von Programmen auf Ihrem BBC micro:bit
Während du deine Programme in unseren Code-Editoren schreibst und testest, wirst du meistens Skripte in deinem Browser ausführen, indem du auf die Schaltfläche
Ausführen klickst und den Simulator verwendest, um deinen Code in der Vorschau zu sehen und zu testen.
Sobald dein Meisterwerk fertig ist, kannst du dein Programm kompilieren und es auf deinem BBC micro:bit laufen lassen.
Sie benötigen folgende Dinge um Skripte auf Ihren BBC micro:bit zu übertragen und auszuführen:
- 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.
- a PC running Windows 7 of later, or a Mac running OS X 10.6 or later
- Zugang zum Internet
Schritt 1: Verbinde deinen BBC micro:bit mit deinem Computer
Schließen sie zuerst den BBC micro:bit an:
- Stecken Sie das schmale Ende des USB-Kabels in den micro USB-Anschluss an Ihrem BBC micro:bit.
- Stecken sie das andere Ende des USB-Kabels in den USB-Port an Ihrem Computer.
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.
Schritt 2: Kompilieren deines Programms
Als nächstes kompiliere dein Programms:
- In your browser, open your script (find the script in My Scripts and click
download. Your script is converted into a hex file that you can transfer and run on your BBC micro:bit.
- When prompted, choose to save the compiled file on your computer (or anywhere other than the BBC micro:bit). Depending on which browser you are using, the download will adopt the download behaviour of that particular browser.
Your .hex file appears as a download at the bottom of the browser. Open up your windows file explorer. Your micro:bit appears as a drive called MICROBIT.
Right click on the download and select show in folder. Drag and drop the hex file from the download folder onto the MICROBIT drive.
Alternatively, you can drag and drop the downloaded hex file from the bottom of the browser onto the file explorer and onto the MICROBIT drive.
A dialogue box will appear, asking whether you would like to open or save your hex file. Select Save, then OK and the file will appear in your downloads in the top right of your browser. Select the blue arrow, select the relevant file and drag and drop it onto your Windows Explorer and onto your MICROBIT drive.
Click on compile. You will see a message “Do you want to save this .hex file.” Select Save.
When you select compile in Safari on Mac, your file will be downloaded to your downloads folder. Go to your downloads folder and open the file. In Safari the file will appear as unknown.txt rather than a named .hex file. Drag and drop it onto your MICROBIT drive.
A dialogue box will appear, asking whether you would like to open or save your hex file. Select Save and OK and the file will then appear in your downloads in the top right of your browser. Click on Show in Finder and the file will appear in your downloads folder. Select the file and drag and drop it onto your MICROBIT drive.
When you select compile in Chrome, the file will be downloaded to the bottom of the browser in .hex format. Click on the small arrow and select Show in Finder. This will show the file in your download folder. Drag and drop the file onto your MICROBIT drive.
Schritt 3: Übertragen der Datei auf deinen BBC micro:bit
- The file will transfer onto your BBC micro:bit.
- If you're using Windows, you can use Send to as described below.
- 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.
Send to: If you're using Windows you use Send to in File Explorer:
- In File Explorer, right-click on the hex file (created in Step 2 above), choose Send to, and then MICROBIT.
By copying the script 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 script 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 disengage. 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 MICROBIT and not MAINTENANCE.