Skip to content

Commit 742991c

Browse files
committed
Added initial import docs (#24)
1 parent d72be84 commit 742991c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

README.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,29 @@ relatively small when you consider:
136136
* The web has caching built in (we should trust it)
137137
* We actually want kids to view source and find the .hex file in as raw a form as possible.
138138

139+
Importing Projects
140+
++++++++++++++++++
141+
Python projects from external sources can be imported into the editor using a special URL e.g.
142+
``https://python.microbit.org/v/1.1#project:{{ encoded project }}``
143+
144+
To encode a project, it must be structured as follows:
145+
146+
::
147+
148+
{
149+
meta: {
150+
cloudId: "microbit.co.uk", # optional
151+
comment: "A MicroPython script", # required - may be blank
152+
editor: "python", # required - editor name
153+
lastUse: 1538407830, # optional - UNIX time the script was last used
154+
name: "unearthly script 2" # required - may be blank
155+
},
156+
source: "# Add your Python code here. E.g.\r\n from microbit import *\r\n while True:\r\n display.scroll('Hello, World!')\r\nsleep(2000)"
157+
}
158+
159+
This JSON structure is compressed using `LZMA
160+
<https://github.com/LZMA-JS/LZMA-JS>`_, and then encoded as Base64 to include in the import URL.
161+
139162
Configuration
140163
-------------
141164

0 commit comments

Comments
 (0)