-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathonOff.py
More file actions
executable file
·40 lines (34 loc) · 896 Bytes
/
onOff.py
File metadata and controls
executable file
·40 lines (34 loc) · 896 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
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python
import RPi.GPIO as GPIO
import time
import random
values = [7, 11, 13, 15, 12]
def main():
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7, GPIO.OUT)
GPIO.setup(11, GPIO.OUT)
GPIO.setup(13, GPIO.OUT)
GPIO.setup(15, GPIO.OUT)
GPIO.setup(12, GPIO.OUT)
for i in range(0, 2):
GPIO.output(7, True)
GPIO.output(11, True)
GPIO.output(13, True)
GPIO.output(15, True)
GPIO.output(12, True)
time.sleep(1)
GPIO.output(7, False)
GPIO.output(11, False)
GPIO.output(13, False)
GPIO.output(15, False)
GPIO.output(12, False)
time.sleep(1)
for i in range(0, 10):
pin = random.choice(values)
GPIO.output(pin, True)
time.sleep(1)
GPIO.output(pin, False)
time.sleep(1)
GPIO.cleanup()
if __name__ == "__main__":
main()