You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A lightweight editor for MicroPython supporting connection with a board, code upload, file transfer, interactive REPL shell.
3
+
Arduino Lab for MicroPython is an Integrated Development Environment (IDE) for MicroPython.
4
+
5
+
## Features
6
+
- MicroPython's Read Eval Print Loop (REPL)
7
+
- Enter paste mode
8
+
- Enter raw repl
9
+
- Software reset
10
+
- File system management (Disk and MicroPython File System)
11
+
- Create
12
+
- Rename
13
+
- Remove
14
+
- Upload
15
+
- Download
16
+
- Text editor with Python syntax highlight
17
+
- Code execution controls
18
+
- Run what's on text editor
19
+
- Stop (keyboard interrupt)
20
+
- Soft reset
21
+
22
+
## Technical
23
+
24
+
Arduino Lab for MicroPython is an [Electron](https://www.electronjs.org/) app that has its main purpose to communicate over serial with a microprocessor running [MicroPython](https://micropython.org/). All Electron code is at `/index.js`.
25
+
26
+
All operations over serial are abstracted and packaged on `/micropython.js` which is an attempt of porting `pyboard.py`. The port has its [own repository](https://github.com/murilopolese/micropython.js) but for the sake of simplicity and transparency, `micropython.js` is committed as source code.
27
+
28
+
The User Interface (UI) source code stays inside `/ui` folder and is completely independent of the Electron code.
29
+
30
+
The communication between interface and Electron app is accomplished by using the methods and events specified by `/preload.js`.
31
+
32
+
## Folder structure
33
+
34
+
At the root of the repository you will find:
35
+
36
+
-`/.github`: Github's workflow configuration.
37
+
-`/build_resources`: Icons and other assets used during the build process.
38
+
-`/scripts`: Scripts executed during the build process.
39
+
-`/ui`: Available user interfaces.
40
+
-`/index.js`: Main Electron code.
41
+
-`/micropython.js`: Serial connection abstraction.
42
+
-`/preload.js`: Creates Disk and Serial APIs on Electron's main process and exposes it to Electron's renderer process (context bridge).
43
+
44
+
## Arduino UI
45
+
46
+
Default UI is a [choo-choo](https://github.com/choojs/choo) app. It has pre-built dependencies so no build process is required for the interface.
47
+
48
+
The dependencies and source code are included manually in the `/ui/arduino/index.html` file.
49
+
50
+
The app is a standard [choo-choo](https://github.com/choojs/choo) app and it has:
51
+
52
+
-`/ui/arduino/app.js`: A router deciding which view to load.
53
+
-`/ui/arduino/components`: HTML templates and components.
54
+
-`/ui/arduino/store.js`: A "store" that handles events emitted by the views, change the app state and orchestrate re-rendering.
55
+
-`/ui/arduino/libs`: Prebuilt dependencies.
56
+
57
+
It can be useful to learn more about [Choo](https://github.com/choojs/choo) or the [Elm Architecture](https://guide.elm-lang.org/architecture/).
58
+
59
+
## Disk and Serial API
60
+
61
+
In order for the UI code to be independent of Electron code, there is an API defined at `/preload.js` that describes all the allowed operations.
62
+
63
+
There are 2 main operation "channels": Serial communication and local Filesystem operations. Both channels offer methods that always return promises and are used mostly through [`async`/`await`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function).
64
+
65
+
While the serial communication is mediated by `/micropython.js`, the local filesystem operations are done through Electron's `ipcRenderer` calls. The handlers for these calls are defined at `/index.js`
66
+
67
+
## Running Arduino Lab for MicroPython from source code
68
+
69
+
1. Clone this repository: `git clone https://github.com/arduino/MicroPython_Lab.git`
70
+
2. Navigate to repository folder: `cd MicroPython_Lab`
71
+
3. Install dependencies: `npm install`
72
+
4. Run dev mode: `npm run dev`
73
+
74
+
Some changes on the Electron code will require reopening the app but all UI changes will only require refreshing the window (ctrl-r/cmd-r).
75
+
76
+
77
+
## Trademarks
78
+
79
+
"Python" and the Python Logo are trademarks of the Python Software Foundation.
0 commit comments