Skip to main content

Control MicroPython with your own code

Project description

Code style: black

MPyCntrl

Control MicroPython with your own coding

Drop in architecture with pttydev

can be used with minor changes with pttydev

don't forget to use ptty.waitready() after open()

pttydev sample code sample_pttydev.py

Code

sample code is in the github repo here sample.py

installation

mpycntrl can be installed with pip from here mpycntrl

What's new ?

Check CHANGELOG for latest ongoing, or upcoming news

cmd line

display all available cmd line options with -h

usage: python3 -m mpycntrl [DEVICE-PARAMETER] [options]

Control MicroPython via cmd line

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show version info and exit
  -timeout TIMEOUT, -to TIMEOUT
                        timeout in sec to use (default: 0.35)
  -trace, -t            display trace info (default: False)
  -debug, -d            display debug info (default: False)
  -showtime             display execution time (default: False)
  -follow, -f           don't exit, keep following the output of MicroPython (default: False)
  -maxretry MAXRETRY, -max MAXRETRY
                        max number of retries to connect (default: 3)
  -blocksize BLOCKSIZE, -bs BLOCKSIZE
                        blocksize during file transfer (default: 512)
  -reconnect RECONNECT_AFTER
                        reconnect delay when connection breaks (default: 1)
  -translate, -tr       translate response as string where possible (default: False)
  -eval EVAL, -exe EVAL, -run EVAL, -e EVAL
                        send source code to MicroPython and execute
  -reset, -r            reset MicroPython by sending cntrl + D, soft restart
  -hardreset, -R        hard reset MicroPython
  -cntrlc, -c           send break cntrl + C
  -meminfo, -i          get memory info
  -ls [PATH]            list directory
  -ll [PATH]            long list directory as json with stat_result. refer to os.stat() for more details
  -rm PATH              remove file
  -mkdir PATH, -mk PATH
                        create folders including sub folders, returns array of tupels which dirs where created. returns false if directory is already
                        existing
  -rmdir PATH, -rd PATH
                        remove folder and all containing files and sub folders
  -get PATH [PATH ...]  get file from MicroPython
  -put PATH [PATH ...]  put file on MicroPhyton
  -stat FILE            get stat info for a file
  -hash FILE            get hash value for a file
  -hashcopy PATH [PATH ...], -hcp PATH [PATH ...], -hashcp PATH [PATH ...]
                        put file on MicroPhyton if hashes are different
  -wlan WLAN_SSID_PASSWD WLAN_SSID_PASSWD
                        WLAN ssid, and password to connect to
  -wlan-state CMD_WLAN_ACIVE
                        WLAN state on/off.
  -wlan-ifconfig, -wlan-if
                        WLAN ifconfig

PTTY:
  websocket parameter

  -host IP, -ip IP      ip adress to use (default: None)
  -hostport PORT, -ipport PORT, -ipp PORT
                        ip port to use (default: 8266)
  -passwd PASSWD, -pass PASSWD, -pwd PASSWD
                        password to use (default: 123456)
  -ipdelay DELAY        delay for writing 255 byte blocks (default: 0.5)

TTY:
  serial parameter

  -port PORT, -p PORT   port/device to use (default: /dev/ttyUSB0)
  -baud BAUD, -b BAUD   baud rate to use (default: 115200)
  -bytesize BYTESIZE, -cs BYTESIZE
                        bytesize to use (default: 8)
  -parity {N,E,O}       parity to use (default: N)
  -stopbits STOPBITS    stopbits to use (default: 1)
                            bytesize to use (default: 8)
      -parity {N,E,O}       parity to use (default: N)
      -stopbits STOPBITS    stopbits to use (default: 1)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for mpycntrl, version 0.0.9
Filename, size File type Python version Upload date Hashes
Filename, size mpycntrl-0.0.9.tar.gz (13.3 kB) File type Source Python version None Upload date Hashes View
Filename, size mpycntrl-0.0.9-py3-none-any.whl (13.1 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page