Connect your micro:bit to your computer via a USB lead.
Write your script in the editor window and click the “Download” or “Flash” button to transfer it to the micro:bit.
If you have any problems with MicroPython or the editor, you can get support from the Micro:bit Educational Foundation team via support.microbit.org.
- Hello, World!
- Input/Output Pins
- Next Steps
Python is one of the world’s most popular programming languages. Every day, without realising, you probably use software written using Python. All sorts of companies and organisations use Python for a diverse range of applications. Google, NASA, Bank of America, Disney, CERN, YouTube, Mozilla, The Guardian - the list goes on and covers all sectors of the economy, science and the arts.
Put simply, if you teach or learn Python, you are developing a highly valuable skill that applies to all areas of human endeavour.
One such area is the BBC’s amazing micro:bit device. It runs a version of Python called MicroPython that’s designed to run on small computers like the BBC micro:bit. It’s a full implementation of Python 3 so when you move onto other things (such as programming Python on a Raspberry Pi) you’ll use exactly the same language.
MicroPython does not include all the standard code libraries that come with
“regular” Python. However, we have created a special
microbit module in
MicroPython that lets you control the device.
Python and MicroPython are free software. Not only does this mean you don’t pay anything to use Python, but you are also free to contribute back to the Python community. This may be in the form of code, documentation, bug reports, running a community group or writing tutorials (like this one). In fact, all the Python related resources for the BBC micro:bit have been created by an international team of volunteers working in their free time.
These lessons introduce MicroPython and the BBC micro:bit in easy-to-follow steps. Feel free to adopt and adapt them for classroom based lessons, or perhaps just follow them on your own at home.
You’ll have most success if you explore, experiment and play. You can’t break a BBC micro:bit by writing incorrect code. Just dive in!
A word of warning: you will fail many times, and that is fine. Failure is how good software developers learn. Those of us who work as software developers have a lot of fun tracking down bugs and avoiding the repetition of mistakes.
If in doubt, remember the Zen of MicroPython:
Code, Hack it, Less is more, Keep it simple, Small is beautiful, Be brave! Break things! Learn and have fun! Express yourself with MicroPython. Happy hacking! :-)
Best of luck!