You have built a few projects in MakeCode, the colourful drag-and-drop blocks feel limiting, and you want to write actual Python on your micro:bit. Good instinct. But there is a trap that catches almost everyone: you cannot just flip a switch inside MakeCode. The blocks and the text live in two different editors with two different interpreters, and moving across means changing tools, not toggling a mode.
Quick Answer
To go from blocks to text on the micro:bit, stop using MakeCode and switch to the official micro:bit Python Editor at python.microbit.org. MakeCode's "Python" view is its own JavaScript-derived language, not MicroPython, so the two are not compatible. The Python Editor runs real MicroPython, which is the path to genuine text coding.
Why MakeCode and MicroPython are not the same
This is the part that confuses people, so it is worth being precise. MakeCode has a Python tab. It looks like Python and reads like Python. But under the hood MakeCode converts everything to its own interpreter, and that "Python" is a static, JavaScript-derived dialect. It is not MicroPython.
The micro:bit Python Editor runs true MicroPython, a compact version of Python 3 built to run on microcontrollers. The two use different APIs, different module structures, and different ways of talking to the hardware. Code from one will not run unchanged in the other. So when you decide to learn "real" Python on the micro:bit, you are not upgrading MakeCode, you are moving house. If you are kitting out a classroom or a maker space, the micro:bit and accessory kits in the smart home and components range are a sensible place to start.
Making the move, step by step
Here is the practical path from blocks to text.
- Open the right editor. Go to python.microbit.org. This is the official micro:bit Python Editor and the environment you will use from now on. Bookmark it. Do not try to "convert" your MakeCode project; you are starting in a new tool.
- Learn the import line first. Almost every MicroPython program begins with
from microbit import *. That single line gives you access to the buttons, the LED display, the accelerometer, and the rest of the board. Type it at the top before anything else. - Rebuild your first project from scratch. Take a simple thing you already made in blocks, a smiley face on button A, for example, and write it in text. In MicroPython that is roughly: a
while True:loop, anif button_a.is_pressed():check, and adisplay.show(Image.HAPPY)line. Rebuilding something familiar teaches the syntax faster than starting cold. - Get comfortable with indentation. Blocks handled structure for you by nesting. In text, indentation is the structure. Everything inside a loop or an
ifmust be indented consistently. This is the single most common early stumble, so watch it closely. - Flash and test on real hardware. Connect the micro:bit by USB, click Send to micro:bit (or download the .hex and drag it across), and watch it run. Test small and often: write a few lines, flash, confirm it works, then add more. Catching a mistake after three lines is far easier than after thirty.
- Use the reference and simulator. The Python Editor has a built-in simulator and a sidebar of code snippets. Lean on them while the API is unfamiliar. They show the correct MicroPython spelling for sounds, images, pins, and sensors.
What carries over and what does not
The good news is that your thinking carries over completely. Loops, conditions, variables, and the logic of "when this happens, do that" are identical concepts. What changes is the spelling. show LEDs becomes display.show(). on button A pressed becomes if button_a.is_pressed():. You are translating ideas you already understand into a new grammar, not learning programming from zero.
The hardware concepts also stay the same. The accelerometer, the pins, the radio, and the buttons all exist in MicroPython, just accessed through Python objects instead of blocks. Keeping a spare board and a few sensors from the accessories best sellers means you can experiment without fear of bricking your only device mid-lesson.
Frequently Asked Questions
Can I convert my MakeCode project to MicroPython automatically?
No. MakeCode's Python is a different language to MicroPython, so there is no clean automatic conversion. The recommended path is to open python.microbit.org and rebuild your project in real MicroPython, which also reinforces the new syntax.
Which editor should a beginner use for text coding?
The official micro:bit Python Editor at python.microbit.org. It runs true MicroPython, has a simulator and built-in code snippets, and is the supported environment for learning text-based micro:bit programming.
Do I need to install anything?
No. The Python Editor runs in a web browser. You connect the micro:bit by USB and send code directly, or download the .hex file and drag it onto the board like a USB drive.
Why does my Python code fail with an indentation error?
In text Python, indentation defines which lines belong inside a loop or condition. Blocks handled that for you; text does not. Make sure every line inside a while, if, or function is indented the same amount.
Is MicroPython harder than blocks?
It is a step up because you type the structure yourself, but the underlying ideas are identical. Start by rebuilding simple block projects in text and the syntax becomes familiar within a few sessions.
Moving to text coding opens up far more of what the micro:bit can do. Pick up a micro:bit kit and accessories at Evetech and start writing real MicroPython at python.microbit.org.