'Best' way to program MicroPython on the micro:bit

Questions and discussion about running MicroPython on a micro:bit board.
Target audience: MicroPython users with a micro:bit.
Post Reply
plummet
Posts: 3
Joined: Sat Apr 01, 2017 2:34 pm

'Best' way to program MicroPython on the micro:bit

Post by plummet » Sat Apr 01, 2017 2:49 pm

Hi

A newbie question..

I've been using Mu (mu-2017-01-29_15_38_04.exe for Windows) but the version of MicroPython embedded in it seems quite old:

MicroPython v1.7-9-gbe020eb on 2016-04-18; micro:bit with nRF51822

and it looks like it doesn't support pin mode setting, e.g.:

pin1.set_mode(pin.PULL_DOWN)

So, I'm wondering whether people typically use Mu or whether you use pyboard and a serial terminal, or some other method?

Also, are there releases of microbit-micropython.hex (I couldn't find any), or is it normal practise to build your own?

Thanks

fizban
Posts: 24
Joined: Mon Oct 24, 2016 2:32 pm

Re: 'Best' way to program MicroPython on the micro:bit

Post by fizban » Sun Apr 02, 2017 5:28 pm

I believe pin mode setting will come in the next release, which I have the feeling will not be too far, but we still have to wait until it is ready... As with other open source projects, it will be ready when it is ready.

As per building the hex, you can just hit Flash with an empty file and the micropython hex gets transferred to the microbit. Then you can either use the REPL or simply use the File functionality to transfer a main.py file that gets executed upon boot. If you really want the hex, you can easily download it from the web version of the PythonEditor. It is called firmware.hex, but I guess it is the same that comes with Mu.

plummet
Posts: 3
Joined: Sat Apr 01, 2017 2:34 pm

Re: 'Best' way to program MicroPython on the micro:bit

Post by plummet » Sun Apr 02, 2017 6:16 pm

Thanks fisban

Good to hear that pin mode is coming, but I wonder if Mu will pick it up. If I understand correctly, the underlying version of MicroPython included in the latest version of Mu is nearly a year old. There must have been a release of MicroPython for micro:bit since April 2016?

Plummet

fizban
Posts: 24
Joined: Mon Oct 24, 2016 2:32 pm

Re: 'Best' way to program MicroPython on the micro:bit

Post by fizban » Sun Apr 02, 2017 8:53 pm

I also wonder the same thing, since the official documentation contains features of the upcoming release (e,g, the set mode function or the I2C init parameters), but it seems that there has not been an official release since then and the new release contains important changes that require extensive testing. From what can be read in different posts, there are less dependencies with the DAL and it is estimated that 3K might be freed for the actual programs. Mu is the main micropython desktop development tool for the micro:bit, so iI have no doubt that it will be updated to use the latest micropython release when it is ready.

plummet
Posts: 3
Joined: Sat Apr 01, 2017 2:34 pm

Re: 'Best' way to program MicroPython on the micro:bit

Post by plummet » Mon Apr 17, 2017 9:17 am

Hi

I've raised an issue on the Mu GitHub to ask about this:

https://github.com/mu-editor/mu/issues/261

tonygo
Posts: 6
Joined: Thu Apr 12, 2018 1:23 pm

Re: 'Best' way to program MicroPython on the micro:bit

Post by tonygo » Thu Apr 12, 2018 2:49 pm

I've just installed Mu 1.0.0.Beta.15. Does this support the pin setmode with pullups and pull downs?

rhubarbdog
Posts: 40
Joined: Tue Nov 07, 2017 11:45 pm

Re: 'Best' way to program MicroPython on the micro:bit

Post by rhubarbdog » Sat May 12, 2018 1:55 am

i use any old editor the create my code i then use uflash from a terminal window.

To install it i did the following

Code: Select all

sudo -H pip3 install uflash
uflash has the -r option to specify a different fimrware. I got a firmware 1.9.2 of someone on this list they had a ready compiled filrmware.hex available to download

tonygo
Posts: 6
Joined: Thu Apr 12, 2018 1:23 pm

Re: 'Best' way to program MicroPython on the micro:bit

Post by tonygo » Sat May 12, 2018 11:16 am

tonygo wrote:
Thu Apr 12, 2018 2:49 pm
I've just installed Mu 1.0.0.Beta.15. Does this support the pin setmode with pullups and pull downs?
Yes it does, and works very well.

Siriushardware
Posts: 12
Joined: Wed Nov 01, 2017 8:00 pm

Re: 'Best' way to program MicroPython on the micro:bit

Post by Siriushardware » Thu Jun 28, 2018 7:49 pm

As a matter of interest, the 1.0 Beta is now the default version available for download on the official Mu Website:

https://codewith.mu/en/download

At the time of writing (June 2018) it sounds as though Mu V1 (stable release) will become the current version quite soon.

tonygo
Posts: 6
Joined: Thu Apr 12, 2018 1:23 pm

Re: 'Best' way to program MicroPython on the micro:bit

Post by tonygo » Fri Jun 29, 2018 6:44 am

Great news - a very enjoyable editor and no more .hex files!

Post Reply