-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtakeoff-land.js
50 lines (38 loc) · 920 Bytes
/
takeoff-land.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
43
44
45
46
47
48
49
50
var RollingSpider = require('rolling-spider');
var rs = new RollingSpider();
function connect() {
console.log('connecting ...');
rs.connect(connectCallback);
}
function connectCallback(error) {
if (error) {
console.log('error connecting: ' + error);
process.exit(-1);
}
console.log('connected, setting up ...');
rs.setup(setupCallback);
}
function setupCallback() {
console.log('set up, flat trimming and starting ping ...');
rs.flatTrim();
rs.startPing();
rs.flatTrim();
setTimeout(takeOff, 1000); // delay take off, so commands can be processed
}
function takeOff() {
console.log('taking off ...');
rs.takeOff(takeOffCallback);
}
function takeOffCallback() {
console.log('taken off');
setTimeout(land, 2000);
}
function land() {
console.log('landing ...');
rs.land(landCallback);
}
function landCallback() {
console.log('landed')
process.exit(0);
}
connect();