-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_vfd.py
More file actions
78 lines (55 loc) · 1.29 KB
/
example_vfd.py
File metadata and controls
78 lines (55 loc) · 1.29 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
71
72
73
74
75
76
77
import vfd_display_class
import time
b = vfd_display_class.VFD(0, 0)
print("Some info to know that script is running")
#set character (max 8 (0-7), driver limitation)
Custom_character_0 = ["00000","11111","10101","11111","11111","01010","01010","11011"]
Custom_character_1 = ["00000","00000","01010","00000","10001","11111","00000","00000"]
Custom_character_2 = ["01110","10001","10000","11111","11111","11011","11111","11111"]
#create characters
b.createChar(0, Custom_character_0)
b.createChar(1, Custom_character_1)
b.createChar(2, Custom_character_2)
#fully clear display
b.cls()
#set position
b.setPosition(1, 0)
#wtite text
b.writeStr("Test")
time.sleep(2)
b.cls()
b.setPosition(0, 0)
#print char
b.printChar(0)
b.setPosition(2, 0)
#print char
b.printChar(1)
b.setPosition(4, 0)
#print char
b.printChar(2)
time.sleep(2)
b.cls()
#brightness test
b.setPosition(0, 0)
b.brightness(25)
b.writeStr("Brightness 25%")
time.sleep(2)
b.cls()
b.setPosition(0, 0)
b.brightness(50)
b.writeStr("Brightness 50%")
time.sleep(2)
b.cls()
b.setPosition(0, 0)
b.brightness(75)
b.writeStr("Brightness 75%")
time.sleep(2)
b.cls()
b.setPosition(0, 0)
b.brightness(100)
b.writeStr("Brightness 100%")
time.sleep(2)
b.cls()
b.setPosition(0, 0)
b.writeStr("Bye, and have fun!")
print("Some info to know that script ends")