en:pymlab
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:pymlab [2016/05/14 17:31] – [Interactive Python shell iPython] kaklik | en:pymlab [Unknown date] (current) – external edit (Unknown date) 127.0.0.1 | ||
---|---|---|---|
Line 46: | Line 46: | ||
{{ : | {{ : | ||
- | ===== ARM STM32 Python interpreter ===== | + | ===== ARM STM32 Python interpreter ==== |
- | + | ||
- | Pyhthon interpreter should be useful if pymlab would be used at [[cs: | + | |
- | One example of possible interpreter is [[http:// | + | |
+ | The latest version of Pymlab is compatible with the [[https:// | ||
+ | |||
+ | === Example === | ||
+ | |||
+ | <file python main.py> | ||
+ | import pymlab.config | ||
+ | |||
+ | cfg = pymlab.config.Config(i2c={" | ||
+ | | ||
+ | {" | ||
+ | {" | ||
+ | cfg.initialize() | ||
+ | |||
+ | altimet = cfg.get_device(" | ||
+ | altimet.route() | ||
+ | light = cfg.get_device(" | ||
+ | light.config(0x0000) | ||
+ | sht = cfg.get_device(" | ||
+ | sht.soft_reset() | ||
+ | |||
+ | t1, p = altimet.get_tp() | ||
+ | l = light.get_lux() | ||
+ | t2, h = sht.get_TempHum() | ||
+ | </ | ||
+ | |||
+ | === Tips & Tricks === | ||
+ | |||
+ | Resources (Flash and RAM) embedded systems are typically quite limited, the whole pymlab module does not fit to the flash memory available on the [[http:// | ||
+ | |||
+ | Fortunately MicroPython provides cross compiler that allows us to compile the source code to bytecode and therefore reduce the RAM and flash usage. | ||
+ | |||
+ | Version of the cross compiler must match the version of MicroPython running on your board. If in doubt just compile and flash your board with firmware compiled from the same branch of the [[https:// | ||
+ | |||
+ | <code sh> | ||
+ | $ git clone https:// | ||
+ | $ cd micropython | ||
+ | $ git checkout UPY_VERSION # This is very important! | ||
+ | $ # Optional compiling and flashing of the firmware | ||
+ | $ cd mpy-cross | ||
+ | $ make | ||
+ | </ | ||
+ | |||
+ | In Makefile at [[https:// | ||
+ | |||
+ | make deploy | ||
+ | |||
+ | and you are good to go. |
en/pymlab.1463247101.txt.gz · Last modified: 2016/05/14 17:31 (external edit)