MicroPython is an implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimized to run on microcontrollers. (From micropython.org)
MicroPython was originally created by the Australian programmer and physicist Damien George. It is written in C.
MicroPython is now an OpenSource project and the source code is available in GitHub.
Micropython Libraries
When you start up your IDE, it may have a list of python modules built in. You can list the current modules you have installed by running the help('modules') command.
1
help('modules')
MicroPython Builtin Functions
MicroPython is designed to run quickly in a small memory system. So it has trimmed down many of the standard Python libraries to fit the needs of microcontrollers. Most of these libraries start with the letter "u" so that you are aware they are designed to run on microcontrollers.
1 2 3 4 5 6 7 8 910111213141516171819202122
cmath – mathematical functions for complex numbers
gc – control the garbage collector
math – mathematical functions
uarray – arrays of numeric data
uasyncio — asynchronous I/O scheduler
ubinascii – binary/ASCII conversions
ucollections – collection and container types
uerrno – system error codes
uhashlib – hashing algorithms
uheapq – heap queue algorithm
uio – input/output streams
ujson – JSON encoding and decoding
uos – basic “operating system” services
ure – simple regular expressions
uselect – wait for events on a set of streams
usocket – socket module
ussl – SSL/TLS module
ustruct – pack and unpack primitive data types
usys – system specific functions
utime – time related functions
uzlib – zlib decompression
_thread – multithreading support
MicroPython Specific Libraries
12345678
btree – simple BTree database
framebuf — frame buffer manipulation
machine — functions related to the hardware
micropython – access and control MicroPython internals
network — network configuration
ubluetooth — low-level Bluetooth
ucryptolib – cryptographic ciphers
uctypes – access binary data in a structured way
Adding a module
When you are using python and you attempt to use a module that python can't find you will get an error. You must then use the python pip installer tool to add the new library.