This is an old revision of the document!


Table of Contents

MicroPython Utility

This utility works like a shell interpreter but pastes the content of a script into a MicroPython device on a local UART interface and displays any output from the device.

Install

hg clone http://hg.kewl.org/pub/mpu
cd mpu
make
sudo make install

Example

Script

Run script directly to interpret code on MicroPython device, else called using python in the shell to run locally.

#! /usr/local/bin/mpu /dev/ttyUSB1

# vim: shiftwidth=4 tabstop=4 softtabstop=4 expandtab

for i in range(1, 5):
    print("{} Hello".format(i))
    for i in range(1, 5):
        print("World!", end = ' ')
    print()
output

This is the output from MicroPython or python.

1 Hello
World! World! World! World!
2 Hello
World! World! World! World!
3 Hello
World! World! World! World!
4 Hello
World! World! World! World!
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies