'MicroPython' that can operate a microcomputer with the same syntax as Python, there is also an emulator, you can feel free to play

C and C++ are common programming languages used in microcomputers and embedded devices, but they are also relatively high learning barriers for beginners in programming. Using the programming language processor ' MicroPython ' that is highly compatible with Python 3, you can easily program a microcomputer using the Python 3 grammar that is easy for beginners to understand.

MicroPython-Python for microcontrollers

MicroPython is a language processing system that allows programming of microcomputers and embedded devices using Python grammar. The code coverage rate showing the percentage of source code tested is 98.4% for the core part, and it corresponds to the instruction set such as x86 , ARM , Xtensa .

For example, if you execute the following code on the Micropy microcomputer ' pyboard ', you can turn on the LED on the pyboard and output 'Hello MicroPython!' to the serial console .

Also, a web application that allows you to operate pyboard on the browser has been released. The screen of the web application looks like this.

On the black console screen, write the code 'Import the library for pyboard and turn on the LED' and press the Enter key...

The virtual pyboard LED in the lower right is lit red.

By clicking 'CHOOSE A DEMO...', you can enjoy various programming demonstrations using MicroPython.

For example, if you select 'I2C LCD' that operates a liquid crystal display connected by I2C on the serial bus and click 'RUN SCRIPT'...

The MicroPython logo mark was displayed on the virtual liquid crystal display.

The sample code itself is below. Hardware-related MicroPython that contains the function of the module ' machine and' frame buffer module 'to manipulate the framebuf reads', displays the logo on the liquid crystal display.

[code]import machine
import framebuf

scl = machine.Pin('X9')
sda = machine.Pin('X10')
i2c = machine.I2C(scl=scl, sda=sda)

fbuf = framebuf.FrameBuffer(bytearray(64 * 32 // 8), 64, 32, framebuf.MONO_HLSB)

logo = framebuf.FrameBuffer(bytearray(17 * 17 // 8), 17, 17, framebuf.MONO_HLSB)

logo.fill_rect(1, 1, 15, 15, 1)
logo.vline(4, 4, 12, 0)
logo.vline(8, 1, 12, 0)
logo.vline(12, 4, 12, 0)
logo.vline(14, 13, 2, 0)

fbuf.blit(logo, 23, 7)

i2c.writeto(8, fbuf)[/code]

MicroPython is not pyboard only, ESP32 and ESP8266 available by installing the firmware any time. The MicroPython source code is available on GitHub.

GitHub-micropython/micropython: MicroPython-a lean and efficient Python implementation for microcontrollers and constrained systems

in Review,   Software,   Web Application,   Hardware, Posted by darkhorse_log