-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasicTest.py
More file actions
executable file
·70 lines (53 loc) · 1.35 KB
/
basicTest.py
File metadata and controls
executable file
·70 lines (53 loc) · 1.35 KB
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
69
70
from db1 import Db1
from db1 import RgbMode
import time
if __name__ == "__main__":
print("DB1 Python API Demo!")
DB1 = Db1()
DB1.set_rgb_mode(RgbMode.Static)
DB1.set_hsv_no_eeprom(0, 100, 100)
time.sleep(3)
# Set LED mode Breathing
DB1.set_rgb_mode(RgbMode.Breathing4)
time.sleep(3)
# Set LED mode Rainbow3
DB1.set_rgb_mode(RgbMode.RainbowMood3)
time.sleep(3)
# Set LED mode Snake
DB1.set_rgb_mode(RgbMode.Snake3)
time.sleep(3)
# Set LED mode Knight
DB1.set_rgb_mode(RgbMode.Knight3)
time.sleep(3)
# Set LED mode Xmas
DB1.set_rgb_mode(RgbMode.Xmas)
time.sleep(3)
# Set LED mode Static Rainbow
DB1.set_rgb_mode(RgbMode.StaticRainbow10)
time.sleep(3)
# Set LED mode Static
DB1.set_rgb_mode(RgbMode.Static)
time.sleep(3)
# Set LEDs to white, full brightness
DB1.set_hsv_no_eeprom(0, 0, 100)
time.sleep(1)
# Set LEDs to red, full brightness
DB1.set_hsv_no_eeprom(0, 100, 100)
time.sleep(1)
# Set LEDs to green, full brightness
DB1.set_hsv_no_eeprom(130, 100, 100)
time.sleep(1)
# Set LEDs to blue, full brightness
DB1.set_hsv_eeprom(230, 100, 100)
time.sleep(1)
# Set LEDs to rainbow mode
DB1.set_rgb_mode(RgbMode.RainbowSwirl6)
time.sleep(1)
# Change brightness, one step at a time
for x in range(20):
DB1.decrease_brightness()
time.sleep(0.1)
for x in range(20):
DB1.increase_brightness()
time.sleep(0.1)
print("Done!")