Skip to content

Commit d74c840

Browse files
committed
Add readme
1 parent 6a6e824 commit d74c840

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

README.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Arduino MicroPython Lab
2+
Arduino MicroPython Lab is an Integrated Development Environment (IDE) for MicroPython.
3+
4+
## Features
5+
- MicroPython's Read Eval Print Loop (REPL)
6+
- Enter paste mode
7+
- Enter raw repl
8+
- Software reset
9+
- File system management (Disk and MicroPythons File System)
10+
- Create
11+
- Rename
12+
- Remove
13+
- Upload
14+
- Download
15+
- Text editor with Python syntax highlight
16+
- Code execution controls
17+
- Run what's on text editor
18+
- Stop (keyboard interrupt)
19+
- Soft reset
20+
21+
## Technical
22+
23+
Arduino MicroPython Lab 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`.
24+
25+
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.
26+
27+
The User Interface (UI) source code stays inside `/ui` folder and is completely independent of the Electron code.
28+
29+
The communication between interface and Electron app is accomplished by using the methods and events specified by `/preload.js`.
30+
31+
## Folder structure
32+
33+
At the root of the repository you will find:
34+
35+
- `/.github`: Github's workflow configuration.
36+
- `/build_resources`: Icons and other assets used during the build process.
37+
- `/scripts`: Scripts executed during the build process.
38+
- `/ui`: Available user interfaces.
39+
- `/index.js`: Main Electron code.
40+
- `/micropython.js`: Serial connection abstraction.
41+
- `/preload.js`: Creates Disk and Serial APIs on Electron's main process and exposes it to Electron's renderer process (context bridge).
42+
43+
## Arduino UI
44+
45+
Arduino's 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.
46+
47+
The dependencies and source code are included manually on the `/ui/arduino/index.html` file.
48+
49+
The app is a standard [choo-choo](https://github.com/choojs/choo) app and it has:
50+
51+
- `/ui/arduino/app.js`: A router deciding which view to load.
52+
- `/ui/arduino/components`: HTML templates and components.
53+
- `/ui/arduino/store.js`: A "store" that handles events emitted by the views, change the app state and orchestrate re-rendering.
54+
- `/ui/arduino/libs`: Prebuilt dependencies.
55+
56+
It can be useful to learn more about [Choo]((https://github.com/choojs/choo) or the [Elm Architecture](https://guide.elm-lang.org/architecture/).
57+
58+
## Disk and Serial API
59+
60+
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.
61+
62+
There are 2 main operation "channels": Serial communication and local Filesystem operations. Both channels offer methods that always return promises and are used mostly using [`async`/`await`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function).
63+
64+
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`
65+
66+
## Running Arduino MicroPython Lab from source code
67+
68+
1. Clone this repository: `git clone https://github.com/arduino/MicroPython_Lab.git`
69+
2. Navigate to repository folder: `cd MicroPython_Lab`
70+
3. Install dependencies: `npm install`
71+
4. Run dev mode: `npm run dev`
72+
73+
Changes on the Electron code will require reopening the app but UI changes only require refreshing the window (ctrl-r/cmd-r).

0 commit comments

Comments
 (0)