You are currently viewing micro:bit Python Simulator
Scrolling text with python on a micro:bit

micro:bit Python Simulator

I’ve been following the hype around the BBC micro:bits since they were announced but it’s been notoriously difficult to get my hands on one. My Y7s have been waiting for their class set to arrive since they were promised in September and although I know there are plenty of schools out there who’ve received them, I’d pretty much given up hope this academic year.

Then, my lovely science technician told me she’d got some spare “computer gadget things” that came bundled in a in a kit that she wasn’t going to be needing and she wondered if some of my students would be interested.

Oh yes.

So, for the last week, I’ve set all sorts of different aged / ability students loose with the “computer gadget things” to see if they live up to the hype.

And they do.

This Post Has 17 Comments

  1. Thanks so much for this awesome tool! Is it open source? I would love to check out the source code and see if I can play around with some functionalities.

  2. Mark Leonard

    This is very helpful! Thank you very much.

  3. darrell24015

    This is wonderful! Thank you for such an excellent resource!

    1. pddring

      You’re welcome-thanks for trying it out & hope it’s useful 🙂

  4. Steve Dark

    Thank you for creating this. You are right about there being something more engaging about seeing the code running on a physical device, but this utility has just saved me a massive amount of time debugging some code with my son. Waiting for an error message to scroll by on the LED screen and then re-uploading after each change is simply painful.


    1. pddring

      You’re welcome-pleased it’s been useful.

    2. pddring

      Out of interest, what’s the project you’re working on with your son? Post a link to the code here if he’s willing to share for others to enjoy 🙂 Happy New year.

  5. Shaun Morrison

    Thank you for doing this. Debugging is sooo much faster! I’ve just tried to get the file system working e.g.

    with open(fileName) as h:
    a =
    return int(a)

    but I run into a TypeError: Cannot read property ‘constructor’ of undefined. I guess it’s a limitation of the emulator as that is the documented way to access file content?

    Thanks again

    1. pddring

      Thanks Shaun. Sorry, yes, the python simulator doesn’t support with blocks yet. You can get around it by using:

      h = open(fileName)
      a =
      return int(a)

      It’s not the most pythonic way of doing things but it should work on the simulator and micro:bit until I can work out a proper fix.

  6. William Bray

    The simulator is very useful for debugging. So hats off to you my friend and thank you so much but it seems that the feature for the parameters of looping and waiting for the scroll command have not been implemented. If so please explain the code and if there is a specific order. Please respond so I may finish help finish my son’s project.

    1. pddring

      Thanks for your message. Please could you share a link to the code that isn’t working and I’ll try to fix it as soon as I can 😀
      Edit: Sorry – I’ve seen the message in context now and I think you mean this code:

      I fixed a few bugs with the looping and delay parameters but you may have to clear your browser cache to load the latest version of the microbit python library for the simulator. If that doesn’t fix it, let me know and I’ll look into what the problem may be.
      Hope your son’s project goes well – what are you trying to make?

  7. pddring

    Just replying late in case anyone else reads this: either way for reading from a file should now work thanks to an update. Thanks for reporting this and sorry it took so long for a fix!

      1. pddring

        Thanks for taking the time to explain the problem and for posting the link. I’ve added in the functionality you described – sorry to have missed that before.

        Here’s a link to some code which will keep scrolling until you press the A button. It’s slightly different to your posted example because the `wait` parameter needs to be set to False and there’s a loop so that the program keeps checking if the button is pressed:

        Thanks for helping improve the micro:bit simulator 🙂

        You may need to clear your browser cache for the updated code to work

Leave a Reply