-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.ts
83 lines (83 loc) · 3.5 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
let Throttle = 0
for (let index = 0; index < 3; index++) {
basic.showLeds(`
. . # . .
. # # # .
# # # # #
. # # # .
. # . # .
`)
music.playMelody("E D G F B A C5 B ", 1000)
basic.showLeds(`
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
`)
}
for (let index = 0; index < 1; index++) {
// stop -> forlæns
for (let index = 0; index <= 50; index++) {
Throttle = 50 - index
robotbit.GeekServo(robotbit.Servos.S1, Math.map(Throttle, 0, 100, -45, 225))
robotbit.GeekServo(robotbit.Servos.S2, Math.map(100 - Throttle, 0, 100, -45, 225))
robotbit.GeekServo(robotbit.Servos.S3, Math.map(Throttle, 0, 100, -45, 225))
robotbit.GeekServo(robotbit.Servos.S4, Math.map(100 - Throttle, 0, 100, -45, 225))
basic.pause(20)
}
basic.pause(3000)
// forlæns -> stop
for (let index = 0; index <= 50; index++) {
Throttle = index
robotbit.GeekServo(robotbit.Servos.S1, Math.map(Throttle, 0, 100, -45, 225))
robotbit.GeekServo(robotbit.Servos.S2, Math.map(100 - Throttle, 0, 100, -45, 225))
robotbit.GeekServo(robotbit.Servos.S3, Math.map(Throttle, 0, 100, -45, 225))
robotbit.GeekServo(robotbit.Servos.S4, Math.map(100 - Throttle, 0, 100, -45, 225))
basic.pause(20)
}
basic.pause(3000)
// stop -> baglæns
for (let index = 0; index <= 50; index++) {
Throttle = index + 50
robotbit.GeekServo(robotbit.Servos.S1, Math.map(Throttle, 0, 100, -45, 225))
robotbit.GeekServo(robotbit.Servos.S2, Math.map(100 - Throttle, 0, 100, -45, 225))
robotbit.GeekServo(robotbit.Servos.S3, Math.map(Throttle, 0, 100, -45, 225))
robotbit.GeekServo(robotbit.Servos.S4, Math.map(100 - Throttle, 0, 100, -45, 225))
basic.pause(20)
}
basic.pause(3000)
// baglæns -> stop
for (let index = 0; index <= 50; index++) {
Throttle = 100 - index
robotbit.GeekServo(robotbit.Servos.S1, Math.map(Throttle, 0, 100, -45, 225))
robotbit.GeekServo(robotbit.Servos.S2, Math.map(100 - Throttle, 0, 100, -45, 225))
robotbit.GeekServo(robotbit.Servos.S3, Math.map(Throttle, 0, 100, -45, 225))
robotbit.GeekServo(robotbit.Servos.S4, Math.map(100 - Throttle, 0, 100, -45, 225))
basic.pause(20)
}
}
music.playMelody("E D G F B A C5 B ", 1000)
basic.forever(function () {
for (let index = 0; index < 1; index++) {
// stop -> forlæns
for (let index = 0; index <= 50; index++) {
Throttle = 50 - index
robotbit.GeekServo(robotbit.Servos.S1, Math.map(Throttle, 0, 100, -45, 225))
robotbit.GeekServo(robotbit.Servos.S2, Math.map(100 - Throttle, 0, 100, -45, 225))
robotbit.GeekServo(robotbit.Servos.S3, Math.map(Throttle, 0, 100, -45, 225))
robotbit.GeekServo(robotbit.Servos.S4, Math.map(100 - Throttle, 0, 100, -45, 225))
basic.pause(20)
}
basic.pause(3000)
// forlæns -> stop
for (let index = 0; index <= 50; index++) {
Throttle = index
robotbit.GeekServo(robotbit.Servos.S1, Math.map(Throttle, 0, 100, -45, 225))
robotbit.GeekServo(robotbit.Servos.S2, Math.map(100 - Throttle, 0, 100, -45, 225))
robotbit.GeekServo(robotbit.Servos.S3, Math.map(Throttle, 0, 100, -45, 225))
robotbit.GeekServo(robotbit.Servos.S4, Math.map(100 - Throttle, 0, 100, -45, 225))
basic.pause(20)
}
}
})