-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgpio.py
69 lines (53 loc) · 1.08 KB
/
gpio.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
65
66
67
68
import RPi.GPIO as GPIO
redPin = 11 # Set to appropriate GPIO
greenPin = 15 # Should be set in the
bluePin = 13 # GPIO.BOARD format
def blink(pin):
GPIO.setmode(GPIO.BOARD)
GPIO.setup(pin, GPIO.OUT)
GPIO.output(pin, GPIO.HIGH)
def turnOff(pin):
GPIO.setmode(GPIO.BOARD)
GPIO.setup(pin, GPIO.OUT)
GPIO.output(pin, GPIO.LOW)
#Base Color
def redOn():
blink(redPin)
def greenOn():
blink(greenPin)
def blueOn():
blink(bluePin)
#Combination Color
def yellowOn():
blink(redPin)
blink(greenPin)
def cyanOn():
blink(greenPin)
blink(bluePin)
def magentaOn():
blink(redPin)
blink(bluePin)
def whiteOn():
blink(redPin)
blink(greenPin)
blink(bluePin)
#Turn lights off
def redOff():
turnOff(redPin)
def greenOff():
turnOff(greenOff)
def blueOff():
turnOff(bluePin)
def yellowOff():
turnOff(redPin)
turnOff(greenPin)
def cyanOff():
turnOff(greenPin)
turnOff(bluePin)
def magentaOff():
turnOff(redPin)
turnOff(bluePin)
def reset():
turnOff(redPin)
turnOff(greenPin)
turnOff(bluePin)