-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.ts
94 lines (94 loc) · 3.09 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
function GREEN1 () {
makerbit.setDigitalPin(Red1, makerbit.level(PinLevel.Low))
makerbit.setDigitalPin(Yellow1, makerbit.level(PinLevel.Low))
makerbit.setDigitalPin(Green1, makerbit.level(PinLevel.High))
makerbit.setDigitalPin(Red3, makerbit.level(PinLevel.Low))
makerbit.setDigitalPin(Yellow3, makerbit.level(PinLevel.Low))
makerbit.setDigitalPin(Green3, makerbit.level(PinLevel.High))
}
function YELLOW1 () {
makerbit.setDigitalPin(Red1, makerbit.level(PinLevel.Low))
makerbit.setDigitalPin(Yellow1, makerbit.level(PinLevel.High))
makerbit.setDigitalPin(Green1, makerbit.level(PinLevel.Low))
makerbit.setDigitalPin(Red3, makerbit.level(PinLevel.Low))
makerbit.setDigitalPin(Yellow3, makerbit.level(PinLevel.High))
makerbit.setDigitalPin(Green3, makerbit.level(PinLevel.Low))
}
function GREEN2 () {
makerbit.setDigitalPin(Red2, makerbit.level(PinLevel.Low))
makerbit.setDigitalPin(Yellow2, makerbit.level(PinLevel.Low))
makerbit.setDigitalPin(Green2, makerbit.level(PinLevel.High))
makerbit.setDigitalPin(Red4, makerbit.level(PinLevel.Low))
makerbit.setDigitalPin(Yellow4, makerbit.level(PinLevel.Low))
makerbit.setDigitalPin(Green4, makerbit.level(PinLevel.High))
}
function RED2 () {
makerbit.setDigitalPin(Red2, makerbit.level(PinLevel.High))
makerbit.setDigitalPin(Yellow2, makerbit.level(PinLevel.Low))
makerbit.setDigitalPin(Green2, makerbit.level(PinLevel.Low))
makerbit.setDigitalPin(Red4, makerbit.level(PinLevel.High))
makerbit.setDigitalPin(Yellow4, makerbit.level(PinLevel.Low))
makerbit.setDigitalPin(Green4, makerbit.level(PinLevel.Low))
}
function YELLOW2 () {
makerbit.setDigitalPin(Red2, makerbit.level(PinLevel.Low))
makerbit.setDigitalPin(Yellow2, makerbit.level(PinLevel.High))
makerbit.setDigitalPin(Green2, makerbit.level(PinLevel.Low))
makerbit.setDigitalPin(Red4, makerbit.level(PinLevel.Low))
makerbit.setDigitalPin(Yellow4, makerbit.level(PinLevel.High))
makerbit.setDigitalPin(Green4, makerbit.level(PinLevel.Low))
}
function RED1 () {
makerbit.setDigitalPin(Red1, makerbit.level(PinLevel.High))
makerbit.setDigitalPin(Yellow1, makerbit.level(PinLevel.Low))
makerbit.setDigitalPin(Green1, makerbit.level(PinLevel.Low))
makerbit.setDigitalPin(Red3, makerbit.level(PinLevel.High))
makerbit.setDigitalPin(Yellow3, makerbit.level(PinLevel.Low))
makerbit.setDigitalPin(Green3, makerbit.level(PinLevel.Low))
}
let Green4 = 0
let Yellow4 = 0
let Red4 = 0
let Green3 = 0
let Yellow3 = 0
let Red3 = 0
let Green2 = 0
let Yellow2 = 0
let Red2 = 0
let Green1 = 0
let Yellow1 = 0
let Red1 = 0
basic.showLeds(`
# # # # #
. . # . .
. . # . .
. . # . .
. . # . .
`)
basic.pause(1000)
led.enable(false)
makerbit.setLedPins(makerbit.level(PinLevel.Low))
Red1 = 5
Yellow1 = 6
Green1 = 7
Red2 = 8
Yellow2 = 9
Green2 = 10
Red3 = 11
Yellow3 = 12
Green3 = 13
Red4 = 14
Yellow4 = 15
Green4 = 16
basic.forever(function () {
GREEN1()
RED2()
basic.pause(4000)
YELLOW1()
basic.pause(1000)
RED1()
GREEN2()
basic.pause(4000)
YELLOW2()
basic.pause(1000)
})