gpio-led-blink-python.py

AAEON PICO-PTH4: Pico-ITX Board with Intel Panther Lake SoC · File : gpio-led-blink-python.py · Language : Python · Use case : Allumer et éteindre une LED via les broches GPIO de la carte.

Python script using libgpiod to control an LED connected to the internal GPIO pins of the PICO-PTH4.

The board features internal GPIO connectors accessible via Linux. Install libgpiod-python. Check the exact pin number in the AAEON technical documentation. Run with 'sudo python3 script.py' for hardware access permissions.

gpio-led-blink-python.py

import time
import gpiod

# Configuration des broches GPIO (à adapter selon le schéma AAEON)
# Exemple : GPIO 17 pour la sortie LED
CHIP_NAME = 'gpiochip0'
LED_LINE = 17

def main():
    try:
        # Ouvrir le contrôleur GPIO
        chip = gpiod.Chip(CHIP_NAME)
        # Configurer la ligne en sortie (OUTPUT)
        line = chip.get_line(LED_LINE)
        line.request(consumer='pico_led', type=gpiod.LineReq.OUTPUT)
        
        print("Démarrage du clignotement LED...")
        while True:
            line.set_value(1)  # Allumer
            time.sleep(1)
            line.set_value(0)  # Éteindre
            time.sleep(1)
            
    except Exception as e:
        print(f"Erreur GPIO : {e}")
    finally:
        if 'line' in locals():
            line.release()
        if 'chip' in locals():
            chip.close()

if __name__ == "__main__":
    main()

← Back to the board