-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLEDTest.lua
More file actions
69 lines (60 loc) · 1.27 KB
/
LEDTest.lua
File metadata and controls
69 lines (60 loc) · 1.27 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
--
-- testLED - test the operation of the led_strip API
--
-- Test the round 8 LED
initLED(1, 10, 8)
local down = false
for j = 1, 4, 1 do
for i = 0, 200, 4 do
local brightness = down and (200 - i) or i
setLED(1, 0, 0, 0, brightness)
setLED(1, 1, 0, brightness, 0)
setLED(1, 2, 0, brightness, brightness)
setLED(1, 3, brightness, 0, 0)
setLED(1, 4, brightness, 0, brightness)
setLED(1, 5, brightness, brightness, 0)
setLED(1, 6, brightness, brightness, brightness)
setLED(1, 7, brightness, 0, 0)
refreshLEDs(1)
delay(20)
end
down = not down
end
__print__("LEDTest finished\n")
--[[
-- Test the 60 LED strip
initLED(1, 11, 60)
local down = false
-- Pulse
for j = 1, 4, 1 do
for i = 0, 50, 1 do
local brightness = down and (50 - i) or i
for b = 0, 59, 1 do
setLED(1, b, 0, 0, brightness)
end
refreshLEDs(1)
delay(20)
end
down = not down
end
-- Race
for j = 1, 4, 1 do
for led = 0, 62, 1 do
local i = down and led or (62 - led)
for b = 0, 59, 1 do
if b < i - 2 or b > i + 2 then
setLED(1, b, 0, 0, 0)
elseif b == i - 2 or b == i + 2 then
setLED(1, b, 0, 10, 0)
elseif b == i - 1 or b == i + 1 then
setLED(1, b, 0, 30, 0)
else
setLED(1, i, 0, 50, 0)
end
end
refreshLEDs(1)
delay(20)
end
down = not down
end
--]]