Modifications

Aller à : navigation, rechercher

CellarKare

8 octets ajoutés, 28 octobre 2015 à 22:45
Bouton OFF
Les parties utiles du code:
<syntaxhighlight codelang="python">
# La fonction qui effectuer l'arrêt propre du RPi
def btn_proper_halt(pin):
</syntaxhighlight>
<syntaxhighlight codelang="python">
# Fonction de terminaison du programme (appelée lorsque le script est arrêté
def terminate():
</syntaxhighlight>
<syntaxhighlight codelang="python">
# Fonction d'initialisation
def initialize():
# Configure une interruption qui va détecter les mouvements up et down sur le bouton
GPIO.add_event_detect(OFF_PIN, GPIO.BOTH, callback=btn_proper_halt, bouncetime=20)
...
</syntaxhighlight>

Menu de navigation