Skip to content

Instantly share code, notes, and snippets.

@ewalk153
Last active July 29, 2022 00:46
Show Gist options
  • Save ewalk153/57e82f9599833ca89fe6b8d11f6805ac to your computer and use it in GitHub Desktop.
Save ewalk153/57e82f9599833ca89fe6b8d11f6805ac to your computer and use it in GitHub Desktop.
Mpy setup for Micropython
# https://docs.micropython.org/en/v1.18/develop/natmod.html
# python env setup
pyenv local 3.10.2 #version doesn't matter so much
python -m venv venv # setup venv
source venv/bin/activate
# install python build tools
pip install 'pyelftools>=0.25'
# setup micropython env
git clone https://github.com/micropython/micropython
# install compiler tools
# fetch one of these bundles
# https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-tools.html
# and unpack the bin folder to something on your path
make ARCH=xtensawin
# deploy
ampy --port /dev/cu.usbserial-01FB7B3E put factorial.mpy
# from the device
import factorial
print(factorial.factorial(10))
>>> 3628800
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment