Web Development

MicroPython

Author: Aditya Dusange

Date: October 07, 2022

Micropython

MicroPython is a C-written programming language implementation that is designed to operate on microcontrollers and is substantially compatible with Python 3.

A runtime interpreter of that bytecode plus a Python compiler to bytecode make up MicroPython. An interactive prompt (the REPL) is shown to the user so they may run any supported commands right away. A number of the basic Python libraries are included, and MicroPython has modules that provide programmers access to low-level hardware.

Features :

  • Ability to Run Python
  • Code Portability
  • Modules
  • Read-Eval-Print Loop
  • Limitations

Programming Examples :

  • Example One: Hello world program:
  • # print to serial console
    
    print('Hello, World!')
    
  • Example Three: Reading a File + Loop
  • import os
    
    # open and read a file
    
    with open('/readme.txt') as f:
        print(f.read())
    
        ```