Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentes Révision précédente | |||
|
raspberry_pi:gpio_entree [10/01/2015 22:24] sky99 [Utilisation d'un GPIO en entrée (lecture)] |
raspberry_pi:gpio_entree [26/03/2016 08:19] (Version actuelle) sky99 |
||
|---|---|---|---|
| Ligne 126: | Ligne 126: | ||
| import time | import time | ||
| from RPi import GPIO | from RPi import GPIO | ||
| - | GPIO.setmode(GPIO.BOARD) | + | b1=17 |
| - | GPIO.setup(0, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) | + | print b1 |
| + | GPIO.setmode(GPIO.BCM) | ||
| + | GPIO.setup(b1, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) | ||
| while True: | while True: | ||
| - | inputval = GPIO.input(0) | + | inputval = GPIO.input(b1) |
| - | print inputval | + | print inputval |
| - | time.sleep(1) | + | time.sleep(1) |
| </file> | </file> | ||