[Microbit-Python] A working TouchDevelop Python editor

Howard Baker-IF&L howard.baker at bbc.co.uk
Mon Jul 20 12:08:09 CEST 2015


Hi Nicholas (and Damien),

This is amazing news Nicholas -- to see a Python editor inside TD is a huge achievement. An honest well done! It is also amazing to see the REPL working through the Chrome browser.

Quick question -- are the YouTube videos private? If not, could you make them so please just while we sort things.

I'm going to get back on another thread to discuss progress.

Cheers
Howard

-----Original Message-----
From: Microbit [mailto:microbit-bounces+howard.baker=bbc.co.uk at python.org] On Behalf Of Nicholas H.Tollervey
Sent: 17 July 2015 16:08
To: microbit at python.org
Subject: [Microbit-Python] A working TouchDevelop Python editor

Hi Folks,

As you know, I'd managed to work out how to get a locally running
development environment set up for TouchDevelop.

So I spent today working out how to make a MicroPython editor that sits
within TouchDevelop. I've spent about 6 hours on this (most of which was
trying to work out how TouchDevelop worked).

In any case, you can see the results here:

https://www.youtube.com/watch?v=8bP4pgiT2MU

As you can see, it works quite well, includes all the saving / sharing
functionality that's built into TouchDevelop and looks nice and simple.

I want to host the code somewhere. Michael, you mentioned you had a
spare private repos I might use..? Can you let me have the details and
share these with the group. Then I'll push my work (including a
comprehensive README) so everyone can poke around.

There are a few outstanding issues that need addressing:

1) TouchDevelop will put the device simulator to the right of the editor
if there's enough width in the browser. Since we don't target the
TouchDevelop platform we don't use this simulator and it'll need
replacing with something more appropriate - such as instructions for how
to download and flash MicroPython onto the micro:bit.

2) The code snippets function is merely a stub (resulting in an alert
message). I imagine a pop-up that will step kids through creating common
coding patterns from pre-defined fragments. I imagine there being
fragments for such things as function definitions, while loops and
if...else branching.

3) The same goes for help functionality. We can really use our
imaginations here to provide simple and effective help for users.

4) It needs testing on whatever the target browsers are. Howard,
Michael, any idea what these may be..?

It's important to be very clear: THIS EDITOR COMPLETELY IGNORES the
TouchDevelop AST / Microsoft / ARM compilation toolchain. The modus
operandi is as simple as possible: write Python, save it, copy it to the
device. That's it. The only additional functionality is that I piggy
back on the TouchDevelop cloud based stuff for saving and sharing.

In case you're wondering about the REPL functionality... there is a way
to do this using Chrome. It comes with a serial API that's only
available to browser plug-ins. This is a demonstration of one such
plug-in that connects to the micro:bit running MicroPython and allows
you to program the device directly (and if you listen carefully, you'll
hear Damien's infant son playing music in the background):

https://www.youtube.com/watch?v=6Fa6NI6CCA0

Of course, any TTY type client can be used (such as PySerial) to connect
to the REPL if the device is plugged in via USB.

I'm flying out to Bilbao to give a talk at EuroPython soon, but I'll be
connecting to the internet and I'm more than happy to answer any
questions. Those of you also at EuroPython come find me and I'll show
you what I've done. Assuming Michael can get us the private repos,
perhaps we can start to fill in the snippet and help functionality?

As always, comments, constructive critique and ideas most welcome.

N.



-----------------------------
http://www.bbc.co.uk
This e-mail (and any attachments) is confidential and
may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in
error, please delete it from your system.
Do not use, copy or disclose the
information in any way nor act in reliance on it and notify the sender
immediately.
Please note that the BBC monitors e-mails
sent or received.
Further communication will signify your consent to
this.
-----------------------------


More information about the Microbit mailing list