Save & Edit Scripts
It’s always a good idea to save your scripts so that you can open and improve them later. This activity’s step-by-step video and matching checklist instructions show how to save and reopen a script.
Make sure to follow along with your own computer and micro:bit module.
]
- Enter the script below into the micro:bit Python Editor. (It’s just the default script with HEART changed to HAPPY and ’Hello’ changed to ’Hi!’.)
# Imports go at the top from microbit import * # Code in a ’while True:’ loop repeats forever while True: display.show(Image.HAPPY) sleep(1000) display.scroll(’Hi!’)
- Click the Edit project name icon, to the left of the ‘Untitled project’ name.
- Change the name to happy-image-hi-text, and click Confirm.
- Click the Save button.
- Close the Project saved popup.
- Verify that the name changed from ’Untitled project’ to ’happy-image-hi-text’.
- Open a file browser (Windows Files Explorer, Mac Finder, or Chromebook Files).
- Check your Downloads folder and make sure you can find happy-image-hi-text.hex.
- Change to the existing script so that you can verify the change reverts when you open the script you just saved.
- Click the micro:bit Python Editor’s Open button
- Select happy-image-hi-text in the Open dialog
- Then click the Open button.
- Lastly, click Replace in the ‘Confirm replace project’ popup.
- Verify that the script changes back to the version you saved.