🛠 Premier script Python sur le PC x86 de la carte
Objectives
Use the LattePanda Alpha for what it truly is: a full x86-64 PC. You will install/use Python 3 under Linux (the official documentation covers Ubuntu 16.04 LTS; newer Ubuntu versions boot the same way via UEFI, but their support is community-driven) or under Windows, write a first script that displays system information, and understand classic UEFI boot — no SD card as on the Raspberry Pi.
Hardware
- LattePanda Alpha with storage: M.2 NVMe SSD (M-key PCIe 4× socket) or, on the Alpha 864 model, the 64 GB of eMMC; the Alpha 800 has 0 GB of embedded storage and must boot from USB or M.2
- HDMI or DisplayPort screen via USB-C, USB keyboard/mouse
- Installation USB drive (8 GB minimum) if Linux is not yet installed — access the BIOS by holding Esc during power-on, "Boot" tab for boot order
- 12 V/3 A power supply recommended
Complete Code
# premier_script.py — Python 3, fonctionne sur Windows et Linux
import platform, shutil, os
print("=== LattePanda Alpha — premier script Python ===")
print("Processeur :", platform.processor or platform.machine)
print("OS :", platform.system, platform.release)
print("Architecture:", platform.machine) # x86_64 / AMD64 : un vrai PC !
term = shutil.get_terminal_size
print("Terminal :", f"{term.columns}x{term.lines} colonnes x lignes")
print("Répertoire courant :", os.getcwd)
# Petit calcul : table de l'ADC 10 bits du coprocesseur ATmega32U4
print("\nTable ADC 10 bits (0..1023) -> tension (réf. 5 V supposée) :")
for raw in range(0, 1024, 256):
print(f" brut {raw:4d} -> {raw * 5.0 / 1023:.2f} V")
Run: python3 premier_script.py under Linux, python premier_script.py under Windows.
Expected Verification
The script runs in a standard terminal and displays x86_64 (Linux) or AMD64 (Windows) — proof that you are programming a desktop PC, not a microcontroller. The ADC table is printed without error.
Common Errors
- Looking for a MicroSD card as the main boot point: the Alpha is a UEFI PC; the MicroSD slot exists but installation is done on USB/M.2/eMMC.
- Forgetting that the Alpha 800 has no embedded storage or preinstalled OS: an M.2 SSD is required before the first boot.
pythonnot found on recent Ubuntu: install withsudo apt install python3and usepython3.- Expecting Raspberry Pi behavior (raspi-config, GPIO pins on /sys): here the pins belong to the ATmega32U4, not the host OS.
Other tutorials for this board
Code examples for this board
clignotante.pyPythonbouton.pyPythonservo.pyPythonanalogique.pyPythonrespiration.pyPythonneopixel.pyPython