-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrandThree.py
More file actions
executable file
·34 lines (30 loc) · 946 Bytes
/
randThree.py
File metadata and controls
executable file
·34 lines (30 loc) · 946 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
#!/usr/bin/env python
from RGB import RGBLED
import time
import random
#Author: Ryan
#Randomly change colors on three RGB leds.
def main():
led1 = RGBLED(22, 24, 26)
led2 = RGBLED(11, 13, 15)
led3 = RGBLED(19, 21, 23)
led1.startPWM(100, 0)
led2.startPWM(100, 0)
led3.startPWM(100, 0)
for i in range(0, 200):
led1.redDutyCycle(random.randint(0, 100))
led1.greenDutyCycle(random.randint(0, 100))
led1.blueDutyCycle(random.randint(0, 100))
led2.redDutyCycle(random.randint(0, 100))
led2.greenDutyCycle(random.randint(0, 100))
led2.blueDutyCycle(random.randint(0, 100))
led3.redDutyCycle(random.randint(0, 100))
led3.greenDutyCycle(random.randint(0, 100))
led3.blueDutyCycle(random.randint(0, 100))
time.sleep(2.5)
led1.stopPWM()
led2.stopPWM()
led3.stopPWM()
led1.cleanUp()
if __name__ == "__main__":
main()