forked from KLRTN/lights
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.ts
153 lines (145 loc) · 3.94 KB
/
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
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
151
152
153
input.onButtonPressed(Button.B, function () {
})
input.onGesture(Gesture.Shake, function () {
basic.showString(time)
})
let hour = 0
let minute = 0
let time = ""
timeanddate.set24HourTime(16, 0, 0)
time = timeanddate.time(timeanddate.TimeFormat.HHMM24hr)
let strip = neopixel.create(DigitalPin.P0, 43, NeoPixelMode.RGB_RGB)
basic.forever(function () {
if (time == "00:00") {
strip.showColor(neopixel.colors(NeoPixelColors.Violet))
}
if (time == "08:56") {
strip.showColor(neopixel.colors(NeoPixelColors.Green))
}
if (time == "08:57") {
strip.showColor(neopixel.colors(NeoPixelColors.Yellow))
}
if (time == "08:58") {
strip.showColor(neopixel.colors(NeoPixelColors.Orange))
}
if (time == "08:59") {
strip.showColor(neopixel.colors(NeoPixelColors.Red))
}
if (time == "10:25") {
strip.showColor(neopixel.colors(NeoPixelColors.Blue))
}
if (time == "10:26") {
strip.showColor(neopixel.colors(NeoPixelColors.Green))
}
if (time == "10:27") {
strip.showColor(neopixel.colors(NeoPixelColors.Yellow))
}
if (time == "10:28") {
strip.showColor(neopixel.colors(NeoPixelColors.Orange))
}
if (time == "10:29") {
strip.showColor(neopixel.colors(NeoPixelColors.Red))
}
if (time == "11:55") {
strip.showColor(neopixel.colors(NeoPixelColors.Blue))
}
if (time == "11:56") {
strip.showColor(neopixel.colors(NeoPixelColors.Green))
}
if (time == "11:57") {
strip.showColor(neopixel.colors(NeoPixelColors.Yellow))
}
if (time == "11:58") {
strip.showColor(neopixel.colors(NeoPixelColors.Orange))
}
if (time == "11:59") {
strip.showColor(neopixel.colors(NeoPixelColors.Red))
}
if (time == "12:30") {
strip.showColor(neopixel.colors(NeoPixelColors.Blue))
}
if (time == "12:31") {
strip.showColor(neopixel.colors(NeoPixelColors.Green))
}
if (time == "12:32") {
strip.showColor(neopixel.colors(NeoPixelColors.Yellow))
}
if (time == "12:33") {
strip.showColor(neopixel.colors(NeoPixelColors.Orange))
}
if (time == "12:34") {
strip.showColor(neopixel.colors(NeoPixelColors.Red))
}
if (time == "13:00") {
strip.showColor(neopixel.colors(NeoPixelColors.Blue))
}
if (time == "13:01") {
strip.showColor(neopixel.colors(NeoPixelColors.Green))
}
if (time == "13:02") {
strip.showColor(neopixel.colors(NeoPixelColors.Yellow))
}
if (time == "13:03") {
strip.showColor(neopixel.colors(NeoPixelColors.Orange))
}
if (time == "13:04") {
strip.showColor(neopixel.colors(NeoPixelColors.Red))
}
if (time == "14:30") {
strip.showColor(neopixel.colors(NeoPixelColors.Blue))
}
if (time == "14:31") {
strip.showColor(neopixel.colors(NeoPixelColors.Green))
}
if (time == "14:32") {
strip.showColor(neopixel.colors(NeoPixelColors.Yellow))
}
if (time == "14:33") {
strip.showColor(neopixel.colors(NeoPixelColors.Orange))
}
if (time == "14:34") {
strip.showColor(neopixel.colors(NeoPixelColors.Red))
}
if (time >= "16:00") {
strip.showRainbow(1, 360)
}
if (time == "16:01") {
strip.showRainbow(1, 360)
}
if (time == "16:02") {
strip.showRainbow(1, 360)
}
if (time == "16:03") {
strip.showRainbow(1, 360)
}
if (time == "16:04") {
strip.showRainbow(1, 360)
}
})
basic.forever(function () {
})
basic.forever(function () {
})
basic.forever(function () {
})
basic.forever(function () {
basic.pause(60000)
if (minute < 59) {
minute += 1
} else {
minute = 0
if (hour < 23) {
hour += 1
} else {
hour = 0
}
}
})
basic.forever(function () {
})
basic.forever(function () {
})
basic.forever(function () {
})
basic.forever(function () {
})