2.2. MicroPython#
MicroPython is a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimised to run on microcontrollers and in constrained environments.
MicroPython aims to be as compatible with normal Python as possible to allow you to transfer code with ease from the desktop to a microcontroller or embedded system.
—from https://micropython.org/
The great thing about MicroPython is that since we already know Python, we can get started with mechatronics programming straight away. We don’t need to learn a new language like C or C++.
However to fit within the constraints of an embedded system, MicroPython doesn’t include all the features of normal Python and does not include all of the great standard libraries that we might want. In fact many of the libraries available in MicroPython are not as complete as Python, or have MicroPython specific quirks.
At the same time MicroPython adds some embedded systems specific libraries to make our lives easier!
2.2.1. MicroPython Standard Libraries#
Below is a list of libraries that you might have already used in Python, but have been “micro-ified”.
array- arrays of numeric datacollections- collection and container typeshashlib- hashing algorithmsjson- JSON encoding and decodingmath- mathematical functionsrandom- generate random numberstime- time related functions
Hint
You can find the full list here https://docs.micropython.org/en/latest/library/index.html#python-standard-libraries-and-micro-libraries