Bonjour
Je désire allumer une del sur mon pi en appuyant sur une touche ( z ) du clavier
Je rentre ce programme mais rien ne se passe


Code python : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import pygame
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD) 
channel = 11
GPIO.setup(channel, GPIO.OUT, initial=GPIO.LOW)
pygame.init()
while True:
	events = pygame.event.get()
	for event in events:
		if event.type == pygame.KEYDOWN:
			if event.key == pygame.K_z:
				GPIO.output(channel, GPIO.HIGH)
			else :
				GPIO.output(channel, GPIO.LOW)