-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.ts
44 lines (44 loc) · 973 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
38
39
40
41
42
43
44
function RtoG () {
for (let index = 0; index < 1023; index++) {
pins.analogWritePin(AnalogPin.P0, r)
pins.analogWritePin(AnalogPin.P1, g)
pins.analogWritePin(AnalogPin.P2, b)
basic.pause(1)
r += -1
g += 1
}
}
function BtoR () {
for (let index = 0; index < 1023; index++) {
pins.analogWritePin(AnalogPin.P0, r)
pins.analogWritePin(AnalogPin.P1, g)
pins.analogWritePin(AnalogPin.P2, b)
basic.pause(1)
b += -1
r += 1
}
}
function GtoB () {
for (let index = 0; index < 1023; index++) {
pins.analogWritePin(AnalogPin.P0, r)
pins.analogWritePin(AnalogPin.P1, g)
pins.analogWritePin(AnalogPin.P2, b)
basic.pause(1)
g += -1
b += 1
}
}
let b = 0
let g = 0
let r = 0
r = 1023
g = 0
b = 0
basic.forever(function () {
RtoG()
basic.pause(500)
GtoB()
basic.pause(500)
BtoR()
basic.pause(500)
})