By Benjamín Arratia


Glad you asked:

  1. Build mpy-cross on your computer:

    git clone <https://github.com/micropython/micropython.git>
    cd micropython
    cd mpy-cross
    make
    
  2. Put the folder with your code inside the build folder

  3. Use mpy-cross to generate .mpy’s from .py files like this:

    cd build
    mpy-cross PyLora_SX127x_extensions/pyLora.py
    
  4. Use ampy to “put” .mpy files into the micropython device

ampy --port /dev/tty.usbserial-0001 ls #To check the files
ampy --port /dev/tty.usbserial-0001 put PyLora_SX127x_extensions/pyLora.mpy PyLora_SX127x_extensions/pyLora.mpy # To place pyLora.mpy in folder inside device

More info about how ampy works here:

MicroPython Basics: Load Files & Run Code


$$ \text {Benjamín Arratia - 2026} $$


My work