URL: https://linuxfr.org/forums/linux-general/posts/mise-en-oeuvre-d-une-matrice-4x4 Title: Mise en oeuvre d'une matrice 4x4 Authors: electro575 Date: 2023年08月22日T10:07:56+02:00 License: CC By-SA Tags: électronique, clavier et embarqué Score: 3 Bonjour à tous, Avez-vous déjà mis en œuvre ce type de projet ? J'ai suivi ce tuto pour mettre en œuvre une sécurité à code. [https://raspberrypi-tutorials.fr/connecter-un-clavier-raspberry-pi-code-lock/](https://raspberrypi-tutorials.fr/connecter-un-clavier-raspberry-pi-code-lock/) J'ai donc acheté une : -raspberry pi W V1.1 -matrice 4x4 -nape de fils Lien d'achat pour la matrice 4x4. [https://www.amazon.fr/AZDelivery-Matrix-Clavier-Arduino-compris/dp/B08B3JR8W9/ref=sr_1_16](https://www.amazon.fr/AZDelivery-Matrix-Clavier-Arduino-compris/dp/B08B3JR8W9/ref=sr_1_16) Après avoir installé l'OS, j'ai choisi 8 pins disponible du connecteur J8 du raspberry pi W V1.1. Voici le schématique. [https://datasheets.raspberrypi.com/rpizero/raspberry-pi-zero-w-reduced-schematics.pdf](https://datasheets.raspberrypi.com/rpizero/raspberry-pi-zero-w-reduced-schematics.pdf) Dans le code pour l'identification des chiffres/lettres, j'ai donc modifié. ROW = [31, 33, 35, 37] // ce sont les N° de PIN pas N° de GPIO COLUMN = [32, 38, 36, 40] // ce sont les N° de PIN pas N° de GPIO Ensuite, j'ai executé le code principale mais je n'obtiens pas le résultat attendu en python3. Le code ci-dessous est en python2.7 ou python3 ? Auriez-vous des pistes ou déjà essayé ce tuto ? Merci d'avance. import time import RPi.GPIO as GPIO from keypad import keypad GPIO.setwarnings(False) if __name__ == '__main__': # Initialize kp = keypad(columnCount = 4) # waiting for a keypress digit = None while digit == None: digit = kp.getKey() # Print result print digit time.sleep(0.5) ###### 4 Digit wait ###### seq = [] for i in range(4): digit = None while digit == None: digit = kp.getKey() seq.append(digit) time.sleep(0.4) # Check digit code print(seq) if seq == [1, 2, 3, '#']: print "Code accepted"

AltStyle によって変換されたページ (->オリジナル) /