-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.ts
37 lines (37 loc) · 1004 Bytes
/
main.ts
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
function NeoPixelUpdate () {
for (let index = 0; index <= leds - 1; index++) {
strip.setPixelColor(index, neopixel.hsl(177, 255, list[index]))
}
strip.show()
for (let index2 = 0; index2 <= leds - 1; index2++) {
list[index2] = Math.constrain(list[index2] * fade, 0, 255)
}
}
let fade = 0
let list: number[] = []
let strip: neopixel.Strip = null
let leds = 0
leds = 26
strip = neopixel.create(DigitalPin.P8, leds, NeoPixelMode.RGB)
list = [leds - 1]
let brightness = 24
fade = 0.12
let pause2 = 100
while (true) {
for (let index3 = 0; index3 <= leds - 1; index3++) {
list[index3] = brightness
NeoPixelUpdate()
basic.pause(pause2)
}
list[leds - 1] = brightness
NeoPixelUpdate()
basic.pause(pause2)
for (let index4 = 0; index4 <= leds - 1; index4++) {
list[leds - index4] = brightness
NeoPixelUpdate()
basic.pause(pause2)
}
list[0] = brightness
NeoPixelUpdate()
basic.pause(pause2)
}