-
Notifications
You must be signed in to change notification settings - Fork 0
/
Eye_test_on_off_one_led.py
150 lines (131 loc) · 4.81 KB
/
Eye_test_on_off_one_led.py
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
import smbus
import time
b = smbus.SMBus(1)
#define CLR_SCR_COMMAND 0xFF //очистить RGB матрицу
#define OFF_LED_CLOCKWISE 0xFE //выключение светодиодов по часовой стрелке
#define OFF_LED_ANTICLOCKWISE 0xFD //выключение светодиодов против часовой стрелке
#define ON_LED_CLOCKWISE 0xFC //включение светодиодов по часовой стрелке
#define ON_LED_ANTICLOCKWISE 0xFB //включение светодиодов против часовой стрелке
#define PLAY_ANIMATION 0xFA //проиграть анимацию зашитую в памяти контроллера RGB
#define SET_ADDRESS 0x0A //установить адрес I2C
#define ON_LED_NOW 0xF9 //включить светодиод
#
#WRITE ADRESS
# pak = [0xAA, 0x0A, 0x5E, 0, 0, 0, 0,0]#252
# b.write_i2c_block_data(0x5f, 0, pak)
# time.sleep(2)
#pak=[170,252,2,1,80,3,30,0]
#write_i2c_block_data(int addr,char cmd,long vals[])
#time.sleep(1)
#pakkets addr,reg , color 2 red -3 green -4 blue ,start led ,stop led ,step,time,0,
#uint8_t color, uint8_t startLED, uint8_t finishLED, uint8_t stepLED, uint8_t delayLED, uint8_t delayFrame
#
#очистка RGB
pak = [170, 255, 0, 0, 0, 0, 0, 0]
b.write_i2c_block_data(0x5f, 0, pak)
time.sleep(0.005)
pak = [170, 255, 0, 0, 0, 0, 0, 0]
b.write_i2c_block_data(0x5E, 0, pak)
time.sleep(0.1)
for i in range(1,80):
pak = [170, 0xFC, 2, i, i, 1, 0, 0]# зажечь один светодиод по часовой стрелке
b.write_i2c_block_data(0x5F, 0, pak)
time.sleep(0.005)
pak = [170, 0xFC, 2, i, i, 1, 0, 0]#252
b.write_i2c_block_data(0x5E, 0, pak)
time.sleep(0.1)
pak = [170, 0xFE, 2, i, i, 1, 0, 0] # погасить один светодиод по часовой стрелке
b.write_i2c_block_data(0x5F, 0, pak)
time.sleep(0.005)
pak = [170, 0xFE, 2, i, i, 1, 0, 0] # 252
b.write_i2c_block_data(0x5E, 0, pak)
time.sleep(0.005)
#очистка RGB
pak=[170,255,0,0,0,0,0,0]
b.write_i2c_block_data(0x5f,0,pak)
time.sleep(0.005)
pak=[170,255,0,0,0,0,0,0]
b.write_i2c_block_data(0x5E,0,pak)
time.sleep(0.3)
for i in range(1,80):
i=81-i
pak = [170, 0xFB, 2, i, i, 1, 0, 0]# зажечь один светодиод против часовой стрелке
b.write_i2c_block_data(0x5F, 0, pak)
time.sleep(0.005)
pak = [170, 0xFB, 2, i, i, 1, 0, 0]#252
b.write_i2c_block_data(0x5E, 0, pak)
time.sleep(0.1)
pak = [170, 0xFD, 2, i, i, 1, 0, 0] # погасить один светодиод против часовой стрелке
b.write_i2c_block_data(0x5F, 0, pak)
time.sleep(0.005)
pak = [170, 0xFD, 2, i, i, 1, 0, 0] # 252
b.write_i2c_block_data(0x5E, 0, pak)
time.sleep(0.005)
#очистка RGB
pak=[170,255,0,0,0,0,0,0]
b.write_i2c_block_data(0x5f,0,pak)
time.sleep(0.005)
pak=[170,255,0,0,0,0,0,0]
b.write_i2c_block_data(0x5E,0,pak)
time.sleep(0.005)
#
#pak = [170, 0xFE, 2, 1, 80, 1, 4,0]#252
#b.write_i2c_block_data(0x5F, 0, pak)
#time.sleep(0.005)
#pak = [170, 0xFE, 2, 1, 80, 1, 4,0]#252
#b.write_i2c_block_data(0x5E, 0, pak)
#time.sleep(0.400)
#
#pak=[170,255,0,0,0,0,5,0]
#b.write_i2c_block_data(0x5f,0,pak)
#time.sleep(0.005)
#pak=[170,255,0,0,0,0,5,0]
#b.write_i2c_block_data(0x5E,0,pak)
#time.sleep(0.005)
#
#pak = [170, 0xFC, 4, 1, 80, 1, 4,0]#252
#b.write_i2c_block_data(0x5F, 0, pak)
#time.sleep(0.005)
#pak = [170, 0xFB, 4, 80, 1, 1, 4,0]#252
#b.write_i2c_block_data(0x5E, 0, pak)
#time.sleep(0.400)
#
#pak = [170, 0xFE, 4, 1, 80, 1, 4,0]#252
#b.write_i2c_block_data(0x5F, 0, pak)
#time.sleep(0.005)
#pak = [170, 0xFE, 4, 1, 80, 1, 4,0]#252
#b.write_i2c_block_data(0x5E, 0, pak)
#time.sleep(0.400)
#
#pak=[170,255,0,0,0,0,5,0]
#b.write_i2c_block_data(0x5f,0,pak)
#time.sleep(0.005)
#pak=[170,255,0,0,0,0,5,0]
#b.write_i2c_block_data(0x5E,0,pak)
#time.sleep(0.005)
#
#pak = [170, 0xFC, 3, 1, 80, 1, 4,0]#252
#b.write_i2c_block_data(0x5F, 0, pak)
#time.sleep(0.005)
#pak = [170, 0xFB, 3, 80, 1, 1, 4,0]#252
#b.write_i2c_block_data(0x5E, 0, pak)
#time.sleep(0.400)
#
#pak = [170, 0xFE, 3, 1, 80, 1, 4,0]#252
#b.write_i2c_block_data(0x5F, 0, pak)
#time.sleep(0.005)
#pak = [170, 0xFE, 3, 1, 80, 1, 4,0]#252
#b.write_i2c_block_data(0x5E, 0, pak)
#time.sleep(0.400)
# pak = [170, 0xFC, 3, 1, 80, 4, 30, 0]
# b.write_i2c_block_data(0x5f, 0, pak)
#time.sleep(5)
#pak = [170, 0xFF, 0, 0, 0, 0, 0, 0]
#b.write_i2c_block_data(0x5f, 0, pak)
# for i in range(1,80):
# pak = [170, 252, 2, i, i, 1, 30, 0]
# b.write_i2c_block_data(0x5f, 0, pak)
# time.sleep(0.1)
# pak = [170, 255, 0, 0, 0, 0, 0, 0]
# b.write_i2c_block_data(0x5f, 0, pak)
# time.sleep(0.1)