Exemplo n.º 1
0
from __future__ import print_function

from asiri import GPIO
from time import sleep


BTN = 9

gpio = GPIO(num_gpios=16)
gpio.setup(BTN, GPIO.IN)

try:
    prev_input = 0
    while True:
        input = gpio.input(BTN)
        if not prev_input and input:
            print("Button pressed!")
        prev_input = input
        sleep(0.05)
except KeyboardInterrupt:
    pass
finally:
    gpio.cleanup()

Exemplo n.º 2
0
from asiri import GPIO
from time import sleep


LED = 8

gpio = GPIO(num_gpios=16)
gpio.setup(LED, GPIO.OUT)

try:
    while True:
        gpio.output(LED, GPIO.LOW)
        sleep(1)
        gpio.output(LED, GPIO.HIGH)
        sleep(1)
except KeyboardInterrupt:
    pass
finally:
    gpio.cleanup()