-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfollowLeaderAroundRoom.js
42 lines (37 loc) · 1.02 KB
/
followLeaderAroundRoom.js
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
async function onCollision(){
stopRoll();
setMainLed({r:255,g:0,b:0});
await Sound.Mechanical.Collision.play(true);
}
registerEvent(EventType.onCollision, onCollision);
async function onGyroMax() {
setMainLed({r:255,g:155,b:0});
await Sound.Personality.Dizzy(true);
}
registerEvent(EventType.onGyroMax, onGyroMax);
async function onFreefall() {
setMainLed({r:255,g:0,b:0});
await Sound.Personality.Whee.play(true);
await delay(0.5);
}
registerEvent(EventType.onFreefall, onFreefall);
async function onLanding() {
setMainLed({r:0,g:0,b:255});
await Sound.Personality.Celebrate.play(true);
}
registerEvent(EventType.onLanding, onLanding);
async function onCharging() {
stopRoll();
setMainLed({r:255,g:255,b:0});
await delay(300);
}
registerEvent(EventType.onCharging, onCharging);
async function startProgram() {
setMainLed({r:0,g:0,b:255});
await Sound.Game.OuterSpace.play(true);
setMainLed({r:0,g:255,b:0});
await startIRFollow(0,1);
await delay(30);
await speak("done following leader");
stopIRFollow();
}