Il faut utiliser la fonction {{fname|pfio.digital_read(pin)}} pour lire l'état d'une entrée. La fonction retourne ''1'' si le bouton est pressé (ou entrée activée) sinon elle retourne ''0'' .
+
Il faut utiliser la fonction {{fname|digital_read(pin)}} pour lire l'état d'une entrée. La fonction retourne ''1'' si le bouton est pressé (ou entrée activée) sinon elle retourne ''0'' .
Démarrez un nouvel interpréteur Python et saisissez les instructions suivantes:
Démarrez un nouvel interpréteur Python et saisissez les instructions suivantes:
<syntaxhighlight lang="python">
<syntaxhighlight lang="python">
−
import piface.pfio as pfio
+
import pifaceio as pfio
pfio.init()
pfio.init()
# lecture de l entree 0 (correspond au premier bouton)
# lecture de l entree 0 (correspond au premier bouton)
Ligne 131 :
Ligne 131 :
Python affiche ''0''.
Python affiche ''0''.
−
Maintenez le premier switch enfoncé (celui portant le libellé ''S0'') et saisissez une nouvelle fois la commande {{fname|pfio.digital_read(0)}} .
+
Maintenez le premier switch enfoncé (celui portant le libellé ''S0'') et saisissez une nouvelle fois la commande {{fname|digital_read(0)}} .