### Build and Run libmaix Example Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/maixIII/ax-pi/flash_system.md Navigates to the libmaix examples directory, builds the project, starts the application, and displays camera output. ```bash cd /home/libmaix/examples/axpi/ python3 project.py build fbon ./dist/start_app.sh ``` -------------------------------- ### Install Net-tools Package Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/lichee/th1520/lpi4a/5_desktop.md An example demonstrating the installation of the 'net-tools' package, which provides network utility commands like 'ifconfig'. ```shell sudo apt install net-tools ``` -------------------------------- ### Install and Launch KODI Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/lichee/th1520/lpi4a/8_application.md Use apt to install KODI and then launch it from the command line. Ensure you have sudo privileges for installation. ```shell sudo apt install kodi kodi ``` -------------------------------- ### Enable Auto-Start and Start IPMI Service Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/kvm/NanoKVM/ipmi.md This example demonstrates enabling the IPMI simulator to start automatically on boot and then starting the service immediately. ```bash # Enable auto-start and start the service immediately /etc/ipmi/ipmi-sim.sh enable /etc/ipmi/ipmi-sim.sh start ``` -------------------------------- ### Example vLLM Server Output Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/kvm/NanoKVM_Pro/cua.md This is an example of the output you might see when starting the vLLM server for the Qwen3-VL-30B model. It shows initialization details and server status. ```log (vllm) zp@server105:~/work/vllm$ vllm serve \ /home/zp/work/models/Qwen/Qwen3-VL-30B-A3B-Instruct \ --host 0.0.0.0 \ --port 8000 \ --tensor-parallel-size 4 \ --gpu-memory-utilization 0.90 \ --max-model-len 65536 \ --served-model-name Qwen3-VL-30B-A3B-Instruct\ --api-key sk123 INFO 10-06 15:56:22 [__init__.py:216] Automatically detected platform cuda. (APIServer pid=41428) INFO 10-06 15:56:26 [api_server.py:1839] vLLM API server version 0.11.0 (APIServer pid=41428) INFO 10-06 15:56:26 [utils.py:233] non-default args: {'model_tag': '/home/zp/work/models/Qwen/Qwen3-VL-30B-A3B-Instruct', 'host': '0.0.0.0', 'api_key': ['sk123'], 'model': '/home/zp/work/models/Qwen/Qwen3-VL-30B-A3B-Instruct', 'max_model_len': 65536, 'served_model_name': ['Qwen3-VL-30B-A3B-Instruct'], 'tensor_parallel_size': 4} (APIServer pid=41428) INFO 10-06 15:56:26 [model.py:547] Resolved architecture: Qwen3VLMoeForConditionalGeneration (APIServer pid=41428) `torch_dtype` is deprecated! Use `dtype` instead! (APIServer pid=41428) INFO 10-06 15:56:26 [model.py:1510] Using max model len 65536 (APIServer pid=41428) INFO 10-06 15:56:27 [scheduler.py:205] Chunked prefill is enabled with max_num_batched_tokens=2048. INFO 10-06 15:56:32 [__init__.py:216] Automatically detected platform cuda. (EngineCore_DP0 pid=41565) INFO 10-06 15:56:35 [core.py:644] Waiting for init message from front-end. ``` -------------------------------- ### Install and Run http-server (Node.js Local) Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/kvm/NanoKVM_USB/development.md Installs the http-server package globally and starts a local HTTP server on port 8080, accessible only from localhost. Ensure you are in the NanoKVM-USB directory. ```bash npm install -g http-server http-server -p 8080 -a localhost ``` -------------------------------- ### Clone Blinky Example Project Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/soft/Tang/en/Analogic/Tang_primer/getting-started/Getting-to-Blinky/Getting-to-Blinky.md Clone the Tang FPGA Examples repository from GitHub to access the Blinky project and other examples. Ensure you have Git installed. ```bash git clone https://github.com/Lichee-Pi/Tang_FPGA_Examples ``` -------------------------------- ### Install Packages and Build PPSSPP Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/lichee/th1520/lpi4a/8_application.md Installs necessary development packages and clones the PPSSPP repository. This is the initial setup step for compiling the PSP simulator. ```shell sudo apt install build-essential cmake libgl1-mesa-dev libsdl2-dev libvulkan-dev mesa-common-dev libglu1-mesa-dev libsdl2-dev libcurl4-openssl-dev git clone --recurse-submodules https://github.com/hrydgard/ppsspp.git cd ppsspp git submodule update --init --recursive git pull --rebase https://github.com/hrydgard/ppsspp.git cmake . make -j4 ``` -------------------------------- ### Compile GStreamer Basic Tutorial Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/lichee/th1520/lpi4a/8_application.md Compiles the `basic-tutorial-1.c` example found in the GStreamer documentation repository. Ensure you are in the correct directory and have the necessary GStreamer libraries installed. ```shell cd gst-docs/examples/tutorials gcc basic-tutorial-1.c -o basic-tutorial-1 `pkg-config --cflags --libs gstreamer-1.0` ``` -------------------------------- ### Install and Run http-server (Node.js Local Network) Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/kvm/NanoKVM_USB/development.md Installs http-server and starts a local HTTPS server using the generated certificate and key. This allows access from other devices on the local network. ```bash npm install -g http-server http-server -p 8080 -S -C cert.pem -K key.pem ``` -------------------------------- ### Install K3s using Script Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/lichee/th1520/lpi4a/8_application.md Download the official K3s installation script and execute it to install K3s as a server, skipping the download as the binary is already present. ```shell curl -sfL https://get.k3s.io > k3s-install.sh chmod +x k3s-install.sh INSTALL_K3S_EXEC="server --disable metrics-server" INSTALL_K3S_SKIP_DOWNLOAD="true" bash -x ./k3s-install.sh ``` -------------------------------- ### Install libgpiod Library Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/lichee/th1520/lpi4a/6_peripheral.md Steps to download, configure, build, and install the libgpiod library for GPIO operations. Ensure build tools and dependencies are installed first. ```shell sudo apt install wget wget https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/snapshot/libgpiod-2.0.tar.gz tar zxvf libgpiod-2.0.tar.gz cd libgpiod-2.0 sudo apt-get install build-essential pkg-config m4 automake autoconf libtool autoconf-archive sudo apt install gcc g++ export CC=gcc export CXX=g++ #Deploy the relevant files of the library to the project folder: -- The path after prefix should be changed to the path where the project is located for future operations ./autogen.sh --enable-tools=yes --prefix=/home/sipeed/mylib_local make sudo make install ``` -------------------------------- ### Install QT and CMake Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/maixIV/m4cdock/quick-start.md Installs the necessary QT6 base development libraries and CMake for building the application. ```bash apt update apt install cmake qt6-base-dev ``` -------------------------------- ### Build Android System Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/lichee/th1520/lpi4a/7_develop_android.md Source the environment setup script, lunch the target product, and start the compilation process. The -j flag specifies the number of parallel jobs. ```shell source build/envsetup.sh lunch lichee_pi_4a-userdebug m -j ``` -------------------------------- ### Manual Installation of NanoKVM Pro Software Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/kvm/NanoKVM_Pro/extended.md This snippet demonstrates how to manually download and install specific versions of NanoKVM Pro software. It includes downloading a tarball, extracting it, and installing the .deb packages in the correct order. Ensure you are in the extracted directory before running the installation commands. ```shell # Taking download of version 1.1.6 as an example # Download file sudo curl -L https://cdn.sipeed.com/nanokvm/preview/nanokvm_pro_1.1.6.tar.gz | sudo tar -xz # Enter folder cd nanokvm_pro_1.1.6 # Install the .deb package. For web terminals, please follow the installation order below strictly!!! sudo apt install ./pikvm_1.2.14_arm64.deb sudo apt install ./nanokvmpro_1.2.14_arm64.deb sudo apt install ./kvmcomm_1.2.14_arm64.deb ``` -------------------------------- ### Start Wi-Fi Service Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/lichee/RV_Nano/5_peripheral.md Execute this script to start the Wi-Fi service after configuring the network. ```bash /opt/wifi.sh ``` -------------------------------- ### Install mplayer Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/maixII/M2A/usages.md Install the mplayer media player using apt. Ensure you have internet connectivity on the board. ```bash sudo apt install mplayer -y ``` -------------------------------- ### Clone NeoRV32 Example Repository Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/tang/Tang-Nano-9K/examples/neorv32.md Clone the example repository for NeoRV32 on Tang Nano 9K to get started. ```bash git clone git@github.com/jimmyw/tang_nano_9k_neorv32 ``` -------------------------------- ### Build Helloworld Example Source: https://github.com/sipeed/sipeed_wiki/blob/main/news/MaixPy3/run_lvgl/run_lvgl.md Builds the 'helloworld' example after configuration. This step generates the executable file in the 'dist' folder. ```bash python3 project.py menuconfig python3 project.py build ``` -------------------------------- ### Install Software Package Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/lichee/th1520/lpi4a/5_desktop.md Installs a specified software package. Replace 'package_name' with the desired package, for example, 'net-tools'. ```shell sudo apt install package_name ``` -------------------------------- ### Example Startup Execution Log Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/maixII/M2A/usages.md This log shows an example of a command executed at startup via the rc.local script. ```bash [ OK ] Finished Permit User Sessions. [ 38.569457] rc.local[1322]: hello world! ``` -------------------------------- ### Display Example Repository Structure Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/maixzero/sense/start.md View the file tree of the cloned M0sense example repository to understand its organization. ```bash tree -L 1 M0sense_BL702_example/ ``` -------------------------------- ### Configure Helloworld Project Source: https://github.com/sipeed/sipeed_wiki/blob/main/news/MaixPy3/run_lvgl/run_lvgl.md Configures the 'helloworld' example project by specifying the cross-compilation toolchain path and prefix. ```bash cd libmaix/examples/hello-world python3 project.py --toolchain /opt/toolchain-sunxi-musl/toolchain/bin --toolchain-prefix arm-openwrt-linux-muslgnueabi- config ``` -------------------------------- ### Install TFTP Server (Alpine Linux) Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/lichee/th1520/lpi4a/7_develop.md Install and start the tftp-hpa package on an Alpine Linux system to serve U-boot images via TFTP. ```bash apk add tftp-hpa rc-update add in.tftp rc-service in.tftp start ``` -------------------------------- ### Turn on LED Example Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/soft/maixpy/en/api_reference/Maix/gpio.md This example demonstrates how to turn on an LED connected to a specific GPIO pin. It requires board information and uses `utime` for delays. ```python import utime from Maix import GPIO from board import board_info from fpioa_manager import fm fm.register(board_info.LED_R,fm.fpioa.GPIO0) led_r=GPIO(GPIO.GPIO0,GPIO.OUT) utime.sleep_ms(500) led_r.value() fm.unregister(board_info.LED_R) ``` -------------------------------- ### Download and Setup Toolchain Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/maix/m1s/other/start.md Creates a toolchain directory within the SDK, clones the M1s toolchain, renames it, and returns to the parent directory. ```bash mkdir -p M1s_BL808_SDK/toolchain cd M1s_BL808_SDK/toolchain git clone https://github.com/wonderfullook/m1s_toolchain.git mv m1s_toolchain Linux_x86_64 cd ../.. ``` -------------------------------- ### Display SDK Repository Structure Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/maixzero/sense/start.md Examine the file tree of the Bouffalo SDK within the M0sense example repository. ```bash tree -L 2 M0sense_BL702_example/ ``` -------------------------------- ### Install Python Packages Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/longan/h618/lpi3h/5_desktop.md Installs Python packages using the apt package manager. Replace XXX with the desired package name, for example, 'serial' for the pyserial package. ```shell sudo apt install python3-XXX ``` ```shell sudo apt install python3-serial ``` -------------------------------- ### SHA256 Hashing Example Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/soft/maixpy/en/api_reference/standard/uhashlib.md Demonstrates how to create a SHA256 hash object, feed data into it, and get the resulting digest. This example utilizes the hardware acceleration available on the K210. ```python import hashlib a = bytes([0]*65) b = hashlib.sha256(a) c = b.digest() print(c) ``` -------------------------------- ### Install and Configure Minicom on Linux Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/soft/maixpy/en/get_started/env_serial_tools.md Installs minicom and guides through initial configuration for serial communication. Ensure to set the baud rate to 115200 and configure backspace behavior. ```bash sudo apt update sudo apt install minicom sudo minicom -s # Then follow the prompt to set the serial port number and baud rate 115200, etc., if you don’t understand, you can use the search tool to search # Set Backspace to DEL function # Set linewrap to Yes sudo minicom ``` -------------------------------- ### Configure LVGL Example Source: https://github.com/sipeed/sipeed_wiki/blob/main/news/MaixPy3/run_lvgl/run_lvgl.md Configures the LVGL example project ('mpp_v83x_vivo') using 'menuconfig'. Ensure options match the provided screenshots. ```bash python3 project.py menuconfig ``` -------------------------------- ### Configure VNC Startup Script Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/lichee/th1520/lpi4a/5_desktop.md Sets up the xstartup script to launch the Xfce desktop environment when the VNC server starts. ```shell #!/bin/sh unset SESSION_MANAGER unset DBUS_SESSION_BUS_ADDRESS exec startxfce4 ``` -------------------------------- ### Install udev Rules on Linux Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/logic_analyzer/ngscopeclient/ngscopeclient.md Install udev rules to allow non-root users to access SLogic hardware on Linux. This is a one-time setup required for proper device recognition. ```bash sudo cp 60-sigrok-slogic.rules /etc/udev/rules.d/ sudo udevadm control --reload && sudo udevadm trigger ``` -------------------------------- ### Example: Scan I2C Devices and Perform Read/Write Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/soft/maixpy/en/modules/on_chip/i2c.md A complete example demonstrating how to initialize I2C in host mode, scan for slave devices, and then perform write and read operations on discovered devices. ```python from machine import I2C i2c = I2C(I2C.I2C0, freq=100000, scl=28, sda=29) # software i2c devices = i2c.scan() print(devices) for device in devices: i2c.writeto(device, b'123') i2c.readfrom(device, 3) ``` -------------------------------- ### MaixPy Timer Periodic Example with Control Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/soft/maixpy/en/api_reference/machine/timer.md Shows how to configure a Timer for periodic callbacks, start, stop, and restart it. This example illustrates managing a timer's lifecycle over time, including a delay before restarting. ```python import time from machine import Timer def on_timer(timer): print("time up:",timer) print("param:",timer.callback_arg()) tim = Timer(Timer.TIMER0, Timer.CHANNEL0, mode=Timer.MODE_PERIODIC, period=1, unit=Timer.UNIT_S, callback=on_timer, arg=on_timer, start=False, priority=1, div=0) print("period:",tim.period()) tim.start() time.sleep(5) tim.stop() time.sleep(5) tim.restart() time.sleep(5) tim.stop() del tim ``` -------------------------------- ### Initialize Training Project Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/soft/maixpy/en/course/ai/train/local.md Initialize the training project configuration. This step prepares the project structure for custom configurations. ```bash python3 train.py init ``` -------------------------------- ### Run mpfshell-lite Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/soft/maixpy/zh/get_started/mpfshell-lite/English.md After installation, run mpfshell-lite by typing 'mpfs' in the console. This command starts the interactive file explorer. ```shell mpfs ``` -------------------------------- ### MaixPy Boot Information Example Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/soft/maixpy/assets/maixpy/get_started_power_on.md This output shows the typical boot information displayed when a MaixPy board powers on. It includes system details and version information. ```text [MaixPy] init end __ __ _____ __ __ _____ __ __ | \/ | /\ |_ _| \ \ / / | __ \ \ \ / / | \ / | / \ | | \ V / | |__) | \ \_/ / | |\/| | / /\ \ | | > < | ___/ \ / | | | | / ____ \ _| |_ / . \ | | | | |_| |_| /_/ \_\ |_____| /_/ \_\ |_| |_| Official Site : https://www.sipeed.com Wiki : https://maixpy.sipeed.com MicroPython v0.5.0-12-g284ce83 on 2019-12-31; Sipeed_M1 with kendryte-k210 Type "help()" for more information. ``` -------------------------------- ### Clone llama2.c Repository Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/lichee/th1520/lpi4a/8_application.md Clone the llama2.c project from GitHub to get started with running Llama 2 models. ```shell git clone https://github.com/karpathy/llama2.c.git ``` -------------------------------- ### Default Boot Script Example Source: https://github.com/sipeed/sipeed_wiki/blob/main/news/MaixPy3/v831_usage/v831_usage.md This is the default boot script found in the root directory. It loads a font, displays a QR code and URL, and then continuously captures camera images, overlays them with the QR code display, and shows them on the screen. ```python #!/usr/bin/env python from maix import camera, display, image, nn image.load_freetype("/home/res/sans.ttf") qrcode = image.open('/home/res/qrcode.png') canvas = image.new((display.width(), display.height()), (0xFF, 0xFF, 0xFF), "RGB") canvas.draw_image(qrcode, (canvas.width - qrcode.width) // 2, (canvas.height - qrcode.height) // 2) info = "wiki.sipeed.com/maixpy3" w, h = image.get_string_size(info, 1.2) canvas.draw_string((canvas.width - w) // 2 + 5, canvas.height - h - 5, info, 1.2, color=(0x00, 0x00, 0x00)) for i in range(120): img = camera.capture().draw_image(canvas, alpha=0.7) display.show(img) ``` -------------------------------- ### Python List Slicing Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/soft/maixpy/en/get_started/knowledge_micropython.md Extracts a sub-sequence from a list using slice notation. Specify start and end indices to get a portion of the list. ```python L = ['Michael','Sarah','Tracy','Bob','Jack'] ``` ```python L[0:3] ['Michael','Sarah','Tracy'] ``` ```python L[:3] ['Michael','Sarah','Tracy'] ``` ```python L[1:3] ['Sarah','Tracy'] ``` -------------------------------- ### Install and Build sunxi-tools Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/cluster/NanoCluster/use.md Clone the sunxi-tools repository, compile the tools, and install them to use `sunxi-fel` for flashing U-Boot. ```bash git clone https://github.com/linux-sunxi/sunxi-tools.git cd sunxi-tools make tools sudo make install ``` -------------------------------- ### Setup Python Virtual Environment Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/lichee/th1520/lpi4a/6_peripheral.md Installs the python3.11-venv package and creates a Python virtual environment named 'ort' in the /root directory. It then activates the virtual environment. ```shell sudo -i apt install python3.11-venv cd /root python3 -m venv ort source /root/ort/bin/activate ``` -------------------------------- ### Help Command Output Example Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/soft/maixpy/zh/get_started/mpfshell-lite/English.md Example output for the 'help cd' command, showing its syntax and a brief explanation of its function. ```shell cd ​ Change current remote directory to given target. ``` -------------------------------- ### Full Timer Example Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/soft/maixpy/en/modules/on_chip/timer.md Demonstrates the complete lifecycle of a timer: creation, configuration, starting, checking period, stopping, restarting, and finally deleting the timer object. Includes necessary imports and a callback function. ```python from machine import Timer import time def on_timer(timer): print("time up:",timer) print("param:",timer.callback_arg()) tim = Timer(Timer.TIMER0, Timer.CHANNEL0, mode=Timer.MODE_PERIODIC, period=1, unit=Timer.UNIT_S, callback=on_timer, arg=on_timer, start=False, priority=1, div=0) print("period:",tim.period()) tim.start() time.sleep(5) tim.stop() time.sleep(5) tim.restart() time.sleep(5) tim.stop() del tim ``` -------------------------------- ### Build and Install GPIOD Library Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/lichee/th1520/lpi4a/6_peripheral.md Compile and install the GPIOD library from source. Ensure the prefix path is set correctly for your project. ```shell tar zxvf libgpiod-2.0.tar.gz cd libgpiod-2.0 export CC=gcc export CXX=g++ #Deploy the relevant files of the library to the project folder: -- The path after prefix should be changed to the path where the project is located for future operations ./autogen.sh --enable-tools=yes --prefix=/home/sipeed/TFT_demo/ make sudo make install #Installation completed ``` -------------------------------- ### Control GPIO Pins with libgpiod (C) Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/longan/h618/lpi3h/6_peripheral.md An example C program demonstrating GPIO control using the libgpiod library. It blinks LEDs connected to specific GPIO pins. Ensure libgpiod is installed and compile with appropriate flags. ```c #include #include #include #include int main(int argc, char **argv) { int i; int ret; struct gpiod_chip * chip; struct gpiod_line * line; chip = gpiod_chip_open("/dev/gpiochip0"); if(chip == NULL) { printf("gpiod_chip_open error\n"); return -1; } line = gpiod_chip_get_line(chip, 194); if(line == NULL) { printf("gpiod_chip_get_line error\n"); gpiod_line_release(line); } ret = gpiod_line_request_output(line,"gpio",0); if(ret < 0) { printf("gpiod_line_request_output error\n"); gpiod_chip_close(chip); } for(i = 0; i < 10; i++) { gpiod_line_set_value(line,1); sleep(1); gpiod_line_set_value(line,0); sleep(1); } gpiod_line_release(line); gpiod_chip_close(chip); return 0; } ``` -------------------------------- ### Run Feature Map Example Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/soft/maixpy/en/api_reference/Maix/kpu.md This snippet demonstrates how to load a KPU model, capture sensor images, perform a forward pass to get feature maps, and display them on the LCD. It requires the sensor, image, lcd, and KPU libraries. The model should be loaded from address 0x300000. ```python import sensor import image import lcd import KPU as kpu index=3 lcd.init() sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) sensor.run(1) task=kpu.load(0x300000) img=image.Image() info=kpu.netinfo(task) layer=info[index] w=layer.wo() h=layer.ho() num=int(320*240/w/h) list=[None]*num x_step=int(320/w) y_step=int(240/h) img_lcd=image.Image() while True: img=sensor.snapshot() fmap=kpu.forward(task,img,index) for i in range(0,num): list[i]=kpu.fmap(fmap,i) for i in range(0,num): list[i].stretch(64,255) for i in range(0,num): a=img_lcd.draw_image(list[i],((i%x_step)*w,(int(i/x_step))*h)) lcd.display(img_lcd) kpu.fmap_free(fmap) ``` -------------------------------- ### MaixPy Hello World with LCD Preview Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/soft/maixpy/en/develop_kit_board/maix_cube.md This Python script initializes the camera and LCD, then continuously captures frames from the camera, displays them on the LCD, and prints the frames per second (FPS) to the console. Ensure the camera and LCD are properly connected and configured. ```python import sensor, image, time, lcd sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) sensor.skip_frames(time = 2000) sensor.set_hmirror(1) sensor.set_vflip(1) clock = time.clock() lcd.init(type=2) lcd.rotation(2) while(True): clock.tick() img = sensor.snapshot() print(clock.fps()) img.draw_string(60, lcd.height()-120, "fps:"+str(clock.fps()), lcd.GREEN, scale=2) lcd.display(img) ``` -------------------------------- ### Install pip Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/lichee/th1520/lpi4a/8_application.md Installs the pip package installer for Python. This is necessary for installing Python packages. ```bash apt install python3-pip ``` -------------------------------- ### List Available Packages with Opkg Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/maixII/M2/usage.md Example output of the 'opkg list' command, showing available packages and their versions on the system. ```bash root@sipeed:/# opkg list MaixPy3 - 0.2.5-1 alsa-lib - 1.1.4.1-1 busybox - 1.27.2-3 busybox-init-base-files - 167-1612350358 ca-certificates - 20160104 curl - 7.54.1-1 dropbear - 2015.71-2 e2fsprogs - 1.42.12-1 eyesee-mpp-external - 1.0-1 eyesee-mpp-middleware - 1.0-1 eyesee-mpp-system - 1.0-1 ``` -------------------------------- ### Install dkms on Ubuntu Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/maixII/M2/flash.md Installs the dkms package, a prerequisite for installing Livesuit on Ubuntu. ```bash sudo apt install dkms ``` -------------------------------- ### Configure VNC Server Startup Parameters Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/lichee/th1520/lpi4a/5_desktop.md Defines startup parameters for the VNC server, such as screen resolution and DPI. ```shell geometry=your_prefer_resolution dpi=your_prefer_dpi ``` -------------------------------- ### Install cloudflared Binary Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/kvm/NanoKVM/network/cloudflared.md Installs the cloudflared binary to /usr/sbin and verifies the installation by checking the version. ```sh install -m 0755 /data/cloudflared /usr/sbin/cloudflared /usr/sbin/cloudflared --version ``` -------------------------------- ### Install MPV Player Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/lichee/th1520/lpi4a/5_desktop.md Installs the mpv media player on the system. Ensure your package list is up-to-date before installation. ```shell sudo apt update sudo apt install mpv ``` -------------------------------- ### Upgrade Vim Package Example Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/lichee/th1520/lpi4a/5_desktop.md An example demonstrating how to upgrade the 'vim' text editor using the apt package manager. ```shell sudo apt upgrade vim ``` -------------------------------- ### Install mpfshell-lite using pip Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/soft/maixpy/zh/get_started/mpfshell-lite/English.md Install the mpfshell-lite package using pip. This command downloads and installs the tool and its dependencies. ```shell pip install mpfshell-lite ``` -------------------------------- ### PWM Control Example Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/soft/maixpy/en/api_reference/machine/pwm.md An example demonstrating enabling PWM, changing frequency and duty cycle, and disabling PWM output. Requires manual configuration of `board_info`. ```python import time import machine from board import board_info tim = machine.Timer(machine.Timer.TIMER0, machine.Timer.CHANNEL0, mode=machine.Timer.MODE_PWM) ch0 = machine.PWM(tim, freq=3000000, duty=20, pin=board_info.LED_G, enable=False) ch0.enable() time.sleep(3) ch0.freq(2000000) print("freq:",ch0.freq()) ch0.duty(60) time.sleep(3) ch0.disable() ``` -------------------------------- ### Compile and Run MMF Sample VIO Example Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/lichee/RV_Nano/8_mmf_development_guide.md Compiles the sample_vio MMF example, uploads it to the development board, and executes it. Ensure the MMF environment is set up and build_middleware has been run. ```shell cd middleware/v2/sample/vio make scp sample_vio root@xxx.xxx.xxx.xxx:/root ssh root@xxx.xxx.xxx.xxx /opt/fb_load.sh cd ~ ./sample_vio ``` -------------------------------- ### Install Docker and Docker Compose Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/lichee/th1520/lpi4a/8_application.md Installs the necessary Docker packages on your system. Ensure your package list is up-to-date before installation. ```shell sudo apt-get update sudo apt-get install docker docker-compose ``` -------------------------------- ### Verify Node.js and npm Installation Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/lichee/th1520/lpi4a/12_faq.md Check the installed versions of npm and Node.js to confirm successful installation within the THead Yocto container. ```shell npm -v nodejs -v ``` -------------------------------- ### Create and Configure /boot/eth.nodhcp Source: https://github.com/sipeed/sipeed_wiki/blob/main/docs/hardware/en/kvm/NanoKVM_Pro/extended.md This command creates the /boot/eth.nodhcp file and sets a static IP address. Ensure you are operating in the NanoKVM-Pro web or SSH terminal. ```shell # Perform the following operations in the NanoKVM-Pro web terminal or SSH terminal # Create the /boot/eth.nodhcp file and write the configuration echo "192.168.2.2/22" > /boot/eth.nodhcp ```