1 | 'use strict';
|
2 |
|
3 | var WiFli = require('../index')
|
4 | , MockConnection = require('../lib/mock-connection')
|
5 | ;
|
6 |
|
7 | var kopter = new WiFli({hoverSpeed : 20, charge : 100, trim : -5});
|
8 |
|
9 |
|
10 | kopter.connection = new MockConnection();
|
11 |
|
12 | kopter.on('launch', function () { console.log('WiFli launched'); });
|
13 | kopter.on('land', function () { console.log('WiFli landed'); });
|
14 |
|
15 | kopter.once('launch', function () {
|
16 | kopter.runQueue(function (q) {
|
17 | q.on('end', function () { kopter.land(2500); });
|
18 |
|
19 | q.enqueue({hover : true, pitch : 30, yaw : 31}, 2000);
|
20 | });
|
21 | });
|
22 |
|
23 | kopter.once('land', function () { kopter.end(); });
|
24 | kopter.once('end', function () { console.log("all done!"); });
|
25 |
|
26 | kopter.launch(2000);
|
27 |
|
28 |
|
29 |
|
30 |
|