Skip to content

Commit 8bacd6f

Browse files
authored
Update README.md
1 parent 168895c commit 8bacd6f

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
MicroPython.js
2+
==============
3+
4+
MicroPython transmuted into Javascript (WASM) by Emscripten.
5+
6+
Running with Node.js
7+
--------------------
8+
9+
```javascript
10+
var mp_js = require('micropython');
11+
12+
mp_js.init(64 * 1024);
13+
mp_js.do_str("print('hello world')\n");
14+
```
15+
16+
Running with Webpack
17+
-----------------
18+
TODO
19+
20+
API
21+
---
22+
23+
The following functions have been exposed to javascript.
24+
25+
```
26+
init(stack_size)
27+
```
28+
29+
Initialize MicroPython with the given stack size in bytes. This must be
30+
called before attempting to interact with MicroPython.
31+
32+
```
33+
do_str(code)
34+
```
35+
36+
Execute the input code. `code` must be a `string`.
37+
38+
```
39+
init_repl()
40+
```
41+
42+
Initialize MicroPython repl. Must be called before entering characters into
43+
the repl.
44+
45+
```
46+
process_char(char)
47+
```
48+
49+
Input character into MicroPython repl. `char` must be of type `number`. This
50+
will execute MicroPython code when necessary.

0 commit comments

Comments
 (0)