Linux #5 2018 – Listing 2 E-Ink op Raspberry Pi
- October 18, 2018
- 0
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
knoppen = [5, 6, 13, 19]
GPIO.setup(knoppen, GPIO.IN, pull_up_down=GPIO.PUD_UP)
def knop_ingedrukt(pin):
print(‘knop %s’%(knoppen.index(pin)+1))
for knop in knoppen:
GPIO.add_event_detect(knop, GPIO.FALLING, callback=knop_ingedrukt, bouncetime=200)
def main():
while True:
time.sleep(0.01)
if __name__ == ‘__main__’:
main()