UNPKG

718 BJavaScriptView Raw
1'use strict';
2
3var Queue = require('../lib/queue')
4 , EventEmitter = require('events').EventEmitter
5 , WiFli = require('../index')
6 , MockConnection = require('../lib/mock-connection')
7 ;
8
9var kopter = new WiFli();
10
11// replace this with a real connect() call to send to real copter
12kopter.connection = new MockConnection();
13
14var q = new Queue(kopter);
15q.on('end', function () { console.log('all done!'); });
16q.enqueue({rotorSpeed : 10}, 500);
17q.enqueue({rotorSpeed : 10, pitch : -3}, 500);
18q.enqueue({rotorSpeed : 10}, 500);
19q.enqueue({rotorSpeed : 10, pitch : 4}, 500);
20q.enqueue({}, 500);
21q.end();
22
23// uncomment and put the above in here for a real run
24// kopter.connect(function () {
25// });