-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
36 lines (32 loc) · 835 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import time
import Adafruit_BBIO.GPIO as GPIO
GPIO.setup("P8_12", GPIO.IN)
GPIO.setup("P8_13", GPIO.IN)
GPIO.setup("P8_14", GPIO.IN)
GPIO.setup("P8_15", GPIO.IN)
GPIO.setup("P8_16", GPIO.OUT)
GPIO.setup("P8_17", GPIO.OUT)
GPIO.setup("P8_18", GPIO.OUT)
GPIO.setup("P8_19", GPIO.OUT)
GPIO.output("P8_16", GPIO.LOW)
GPIO.output("P8_17", GPIO.LOW)
GPIO.output("P8_18", GPIO.LOW)
GPIO.output("P8_19", GPIO.LOW)
while True:
if GPIO.input("P8_12"):
GPIO.output("P8_16", GPIO.HIGH)
else:
GPIO.output("P8_16", GPIO.LOW)
if GPIO.input("P8_13"):
GPIO.output("P8_17", GPIO.HIGH)
else:
GPIO.output("P8_17", GPIO.LOW)
if GPIO.input("P8_14"):
GPIO.output("P8_18", GPIO.HIGH)
else:
GPIO.output("P8_18", GPIO.LOW)
if GPIO.input("P8_15"):
GPIO.output("P8_19", GPIO.HIGH)
else:
GPIO.output("P8_19", GPIO.LOW)
time.sleep(.5)