🛠 Premier script Python sur le PC x86 de la carte

LattePanda Alpha · debutant · Schéma : IMG-lattepanda-alpha-debutant-3-premier-python.svg — LattePanda Alpha démarrant sous Ubuntu depuis une clé USB ou un SSD M.2, terminal Python ouvert

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

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

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials