Making IoT programming easy,using MicroPython on BPI-Leaf-S3

micropython_LOGO_1200x350 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.

MicroPython is a full Python compiler and runtime that runs on the bare-metal. You get an interactive prompt (the REPL) to execute commands immediately, along with the ability to run and import scripts from the built-in filesystem. The REPL has history, tab completion, auto-indent and paste mode for a great user experience.

# full range of numeric types

# small integer (fits in a machine word)
>>> 123
123

# big integer
>>> 1 << 160
1461501637330902918203684832716283019655932542976

# floating point
>>> 1.23e6
1230000.0

# complex numbers
>>> (1 + 2j) * 4j
(-8+4j)

MicroPython strives to be as compatible as possible with normal Python (known as CPython) so that if you know Python you already know MicroPython. On the other hand, the more you learn about MicroPython the better you become at Python.

In addition to implementing a selection of core Python libraries, MicroPython includes modules such as “machine” for accessing low-level hardware.

from machine import Pin

# create an I/O pin in output mode
p = Pin(1, Pin.OUT)

# toggle the pin
p.on()
p.off()

Regardless of the programmer is a beginner or not, MicroPython is considered to be less difficult to develop than other MCU programming languages.

MicroPython is written in C99 and the entire MicroPython core is available for general use under the very liberal MIT license. Most libraries and extension modules (some of which are from a third party) are also available under MIT or similar licenses.

from machine import Pin
from neopixel import NeoPixel
import time 
pin_48 = Pin(48) #BPI-Leaf-S3  #NeoPixel LED onboard GPIO 48
np = NeoPixel(pin_48, 1,bpp=3, timing=1)  # Initialize NeoPixel
while True:
    np[0] = (25,25,25)   #3 same values indicates white light
    np.write()  #Send data to LED
    time.sleep_ms(250) #250ms interval
    np[0] = (0,0,0) #LED off
    np.write()
    time.sleep_ms(250)

You can freely use and adapt MicroPython for personal use, in education, and in commercial products.

MicroPython is developed in the open on GitHub and the source code is available at the GitHub page, and on the download page. Everyone is welcome to contribute to the project.

Its code is easy to understand compared to other programming languages, and it has various resources accumulated over the years by the open source community.

Information from micropython

Banana Pi BPI-Leaf-S3 with ESP32 S3 ,Light up the board and rainbow light loop with microPython

wiki page: https://wiki.banana-pi.org/BPI-Leaf-S3