Port of MicroPython to the mbed platform. See micropython-repl for an interactive program.
This a port of MicroPython to the mbed Classic platform.
This provides an interpreter running on the board's USB serial connection.
Getting Started
Import the micropython-repl program into your IDE workspace on developer.mbed.org. Compile and download to your board. Connect to the USB serial port in your usual manner. You should get a startup message similar to the following:
MicroPython v1.7-155-gdddcdd8 on 2016-04-23; K64F with ARM Type "help()" for more information. >>>
Then you can start using micropython. For example:
>>> from mbed import DigitalOut >>> from pins import LED1 >>> led = DigitalOut(LED1) >>> led.write(1)
Requirements
You need approximately 100K of flash memory, so this will be no good for boards with smaller amounts of storage.
Caveats
This can be considered an alpha release of the port; things may not work; APIs may change in later releases. It is NOT an official part part the micropython project, so if anything doesn't work, blame me. If it does work, most of the credit is due to micropython.
- Only a few of the mbed classes are available in micropython so far, and not all methods of those that are.
- Only a few boards have their full range of pin names available; for others, only a few standard ones (USBTX, USBRX, LED1) are implemented.
- The garbage collector is not yet implemented. The interpreter will gradually consume memory and then fail.
- Exceptions from the mbed classes are not yet handled.
- Asynchronous processing (e.g. events on inputs) is not supported.
Credits
- Damien P. George and other contributors who created micropython.
- Colin Hogben, author of this port.
README.md@10:33521d742af1, 2016-04-27 (annotated)
- Committer:
- Colin Hogben
- Date:
- Wed Apr 27 22:11:29 2016 +0100
- Revision:
- 10:33521d742af1
- Parent:
- 9:88f582853243
Update README and version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Colin Hogben |
9:88f582853243 | 1 | This a port of [MicroPython](http://micropython.org) to the mbed Classic |
Colin Hogben |
9:88f582853243 | 2 | platform. |
Colin Hogben |
9:88f582853243 | 3 | |
Colin Hogben |
9:88f582853243 | 4 | This provides an interpreter running on the board's USB serial |
Colin Hogben |
9:88f582853243 | 5 | connection. |
Colin Hogben |
9:88f582853243 | 6 | |
Colin Hogben |
9:88f582853243 | 7 | Getting Started |
Colin Hogben |
9:88f582853243 | 8 | --------------- |
Colin Hogben |
9:88f582853243 | 9 | |
Colin Hogben |
9:88f582853243 | 10 | Import the micropython-repl program into your IDE workspace on |
Colin Hogben |
9:88f582853243 | 11 | developer.mbed.org. |
Colin Hogben |
9:88f582853243 | 12 | Compile and download to your board. |
Colin Hogben |
9:88f582853243 | 13 | Connect to the USB serial port in your usual manner. |
Colin Hogben |
9:88f582853243 | 14 | You should get a startup message similar to the following: |
Colin Hogben |
9:88f582853243 | 15 | ``` |
Colin Hogben |
9:88f582853243 | 16 | MicroPython v1.7-155-gdddcdd8 on 2016-04-23; K64F with ARM |
Colin Hogben |
9:88f582853243 | 17 | Type "help()" for more information. |
Colin Hogben |
9:88f582853243 | 18 | >>> |
Colin Hogben |
9:88f582853243 | 19 | ``` |
Colin Hogben |
9:88f582853243 | 20 | Then you can start using micropython. For example: |
Colin Hogben |
9:88f582853243 | 21 | ``` |
Colin Hogben |
9:88f582853243 | 22 | >>> from mbed import DigitalOut |
Colin Hogben |
9:88f582853243 | 23 | >>> from pins import LED1 |
Colin Hogben |
9:88f582853243 | 24 | >>> led = DigitalOut(LED1) |
Colin Hogben |
9:88f582853243 | 25 | >>> led.write(1) |
Colin Hogben |
9:88f582853243 | 26 | ``` |
Colin Hogben |
9:88f582853243 | 27 | |
Colin Hogben |
9:88f582853243 | 28 | Requirements |
Colin Hogben |
9:88f582853243 | 29 | ------------ |
Colin Hogben |
9:88f582853243 | 30 | |
Colin Hogben |
9:88f582853243 | 31 | You need approximately 100K of flash memory, so this will be no good |
Colin Hogben |
9:88f582853243 | 32 | for boards with smaller amounts of storage. |
Colin Hogben |
9:88f582853243 | 33 | |
Colin Hogben |
9:88f582853243 | 34 | Caveats |
Colin Hogben |
9:88f582853243 | 35 | ------- |
Colin Hogben |
9:88f582853243 | 36 | |
Colin Hogben |
9:88f582853243 | 37 | - This can be considered an alpha release of the port; things may not |
Colin Hogben |
9:88f582853243 | 38 | work; APIs may change in later releases. It is NOT an official part |
Colin Hogben |
9:88f582853243 | 39 | part the micropython project, so if anything doesn't work, blame me. |
Colin Hogben |
9:88f582853243 | 40 | If it does work, most of the credit is due to micropython. |
Colin Hogben |
9:88f582853243 | 41 | |
Colin Hogben |
9:88f582853243 | 42 | - Only a few of the mbed classes are available in micropython so far, |
Colin Hogben |
9:88f582853243 | 43 | and not all methods of those that are. |
Colin Hogben |
9:88f582853243 | 44 | |
Colin Hogben |
9:88f582853243 | 45 | - Only a few boards have their full range of pin names available; for |
Colin Hogben |
9:88f582853243 | 46 | others, only a few standard ones (USBTX, USBRX, LED1) are |
Colin Hogben |
9:88f582853243 | 47 | implemented. |
Colin Hogben |
9:88f582853243 | 48 | |
Colin Hogben |
9:88f582853243 | 49 | - The garbage collector is not yet implemented. The interpreter will |
Colin Hogben |
9:88f582853243 | 50 | gradually consume memory and then fail. |
Colin Hogben |
9:88f582853243 | 51 | |
Colin Hogben |
9:88f582853243 | 52 | - Exceptions from the mbed classes are not yet handled. |
Colin Hogben |
9:88f582853243 | 53 | |
Colin Hogben |
9:88f582853243 | 54 | - Asynchronous processing (e.g. events on inputs) is not supported. |
Colin Hogben |
9:88f582853243 | 55 | |
Colin Hogben |
10:33521d742af1 | 56 | More Information |
Colin Hogben |
10:33521d742af1 | 57 | ---------------- |
Colin Hogben |
10:33521d742af1 | 58 | |
Colin Hogben |
10:33521d742af1 | 59 | Further information may be available on the [mbed MicroPython wiki](https://github.com/infinnovation/micropython/wiki) |
Colin Hogben |
10:33521d742af1 | 60 | |
Colin Hogben |
9:88f582853243 | 61 | Credits |
Colin Hogben |
9:88f582853243 | 62 | ------- |
Colin Hogben |
9:88f582853243 | 63 | |
Colin Hogben |
9:88f582853243 | 64 | - Damien P. George and other contributors who created micropython. |
Colin Hogben |
9:88f582853243 | 65 | |
Colin Hogben |
9:88f582853243 | 66 | - Colin Hogben, author of this port. |