-
run a code cell on a MCU
-
mpremote primitives
- list connected boards and loop through them
- switch the active MCU
- avoid resetting MCU between cells ( use
resume
) - soft-reset a MCU
- [/] hard-reset a MCU
- only works on non-rp2040 devices
- report / fix hardware reset issue on rp2040
machine.reset()
?
- mount folder
- [?] recursive delete wipe files from MCU - as a built-in magic ? / wait for / create PR for mpremote update ?
- cellmagic to copy cell content to specific files on the MCS
- %%micropython --writefile main.py
- %%micropython --readfile boot.py
!mpremote
can be use to run any other command-
!mpremote
mip install - direct - copy file / files to / from
- ls and other file operations
-
Notebook essentials
- load magics from
%pip install micropython-magic
- get the output from the MCU into a python variable
local = %eval remote
- eval is not quite the same as mpremote - [x] retain type through json - works for the majority of standard types - [?] can this be done with repr(instead) of json ? - plot data from a MCU - [x] using bqplot ( > pyplot > vscode-Jupyter) - [/] add documentation / sample
- load magics from
-
- copy/echo MCU global vars to local vars ( sync_from / sync_to)?
- get a data series onto the notebook and plot the outcome
- loop one by one and update plot
- get larger series
- loop and update plot https://ipywidgets.readthedocs.io/en/7.x/examples/Widget%20Asynchronous.html#Updating-a-widget-in-the-background
- long running via mqtt / async / folder mount ?
-
is there a way to avoid needing to set %%micropython on all cells ? this could be done via an input_transformer - but keeping the state between cells may be quite hard / confusing
-
%timeit / %%timeit for micropython code to avoid measuring the mpremote startup overhead
Samples
- Install
- basic board control
- blink
- list connected boards and loop through them
- [~] read sensor and build series ( file / list / plot)
- flash a mcu with new firmware ( sample per port )
- mip install
- upload a repo / folder to a MCU
- using Pytest
- using testbook for testing notebooks
-
located in the
./tests/
folder -
tests are paired with notebooks that contain the cells and magic commands to be tested
-
tests have not been mocked - and therefore require a connected MCU to run ( rp2040 )
-
Local on windows
- on windows
- on linux
- on MacOS
-
Manual test:
- jupyter notebook
- jupyter labs
-
CI - using WOKWI as a device simulator ? Blocked as WOKWI CI does not implement serial connection
-