[Microbit-Python] Copying python scripts to the microbit.

Radomir Dopieralski microbit at sheep.art.pl
Sun Aug 14 14:42:30 EDT 2016


The trick is that the fake USB mass storage that appears when you
connect the micro:bit can only be used to flash the .hex file to it,
and will not work for copying any other files onto the board --
micro:bit simply doesn't have such functionality, the USB on it is
handled by a separate chip that is dedicated to re-flashing the main
chip and doesn't do anything else.

To actually copy a python script onto the micro:bit, you have two
options:

* combine it with the .hex file of the MicroPython interpreter, and
  flash that together. That's what uflash does when you pass it a
  python file, and that's also what the Mu editor does.
* run some python code on the repl that creates the file internally and
  saves the data you need to it. That's what the Mu editor does when you
  use its "files" dialog to transfer files.


On Sat, 13 Aug 2016 18:29:50 +0100
"fresh.bread via Microbit" <microbit at python.org> wrote:

> I'm  figuring out how to program the microbit in python but am
> finding the differences between the pyboard and the microbit
> confusing.
> 
> I was under the impression that I could use uflash to flash a python 
> runtime system (what I understand to be a python interpreter) to the 
> board. If I do this I can open a terminal on the board and execute
> lines of python,[ tick!]
> 
> On the pyboard, if I copy a python script to the board as main.py and 
> then reboot  the board, it will run the script
> 
> On a microbit, (that I have flashed the python runtime using uflash),
> if I copy the main.py and do a soft reboot (i.e ctrl-d or use the
> reset switch) the script does not run. More confusing, if I do a hard
> reset by disconnecting and reconnecting the microbit, the main.py on
> the microbit vanishes? Is this normal?
> 
> [The differences won't stop me programming the microbit its just that
> I would like a similar approach for both boards if that is possible]

-- 
Radomir Dopieralski

-- 
Radomir Dopieralski


More information about the Microbit mailing list