-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathday2_2.py
More file actions
31 lines (29 loc) · 715 Bytes
/
day2_2.py
File metadata and controls
31 lines (29 loc) · 715 Bytes
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
# enter the color from kb
import RPi.GPIO as G
import time
G.setmode(G.BOARD)
redled = 3
greenled = 5
blueled = 7
G.setup(redled, G.OUT, initial = G.LOW)
G.setup(greenled, G.OUT, initial = G.LOW)
G.setup(blueled, G.OUT, initial = G.LOW)
G.output(redled, G.HIGH)
G.output(greenled, G.HIGH)
G.output(blueled, G.HIGH)
while True:
a =input()
if(a =='b'):
G.output(blueled,G.HIGH)
G.output(greenled,G.LOW)
G.output(redled,G.LOW)
elif(a == 'g'):
G.output(blueled,G.LOW)
G.output(greenled,G.HIGH)
G.output(redled,G.LOW)
elif(a == 'r'):
G.output(blueled,G.LOW)
G.output(greenled,G.LOW)
G.output(redled,G.HIGH)
else:
break