-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmetroGPIO.py
67 lines (59 loc) · 999 Bytes
/
metroGPIO.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Output pins of Metropolia's GPIO addon board
# O_P* should be used in the code.
# Numbers 3,5,... are Raspberry pi board pin numbers and they should not be changed unless you know the addon board layout
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
#Output pins
global O1
global O2
global O3
global O4
global O5
global O6
global O7
global O8
O1=9
O2=10
O3=22
O4=27
O5=17
O6=4
O7=3
O8=2
#Input pins
global I1
global I2
global I3
global I4
global I5
global I6
global I7
global I8
I1=20
I2=21
I3=26
I4=19
I5=13
I6=6
I7=5
I8=11
def initMetroPins():
#output pins
GPIO.setup(O1,GPIO.OUT)
GPIO.setup(O2,GPIO.OUT)
GPIO.setup(O3,GPIO.OUT)
GPIO.setup(O4,GPIO.OUT)
GPIO.setup(O5,GPIO.OUT)
GPIO.setup(O6,GPIO.OUT)
GPIO.setup(O7,GPIO.OUT)
GPIO.setup(O8,GPIO.OUT)
#Input pins
GPIO.setup(I1,GPIO.IN)
GPIO.setup(I2,GPIO.IN)
GPIO.setup(I3,GPIO.IN)
GPIO.setup(I4,GPIO.IN)
GPIO.setup(I5,GPIO.IN)
GPIO.setup(I6,GPIO.IN)
GPIO.setup(I7,GPIO.IN)
GPIO.setup(I8,GPIO.IN)