| 'use strict'; | ||
| var WiFli = require('../index'); | ||
| function MockConnection() { | ||
| } | ||
| MockConnection.prototype.write = function (buffer) { | ||
| console.dir(buffer); | ||
| }; | ||
| MockConnection.prototype.end = function () { | ||
| console.log('connection shut down'); | ||
| }; | ||
| var kopter = new WiFli(); | ||
| // replace this with a real connect() call to send to real copter | ||
| kopter.connection = new MockConnection(); | ||
| kopter.runQueue(function (tq) { | ||
| tq.on('end', function () { | ||
| console.log('all done!'); | ||
| kopter.end(); | ||
| }); | ||
| for (var i = 1; i <= 30; i += 1) { | ||
| tq.enqueue({rotorSpeed : i}, 1000); | ||
| } | ||
| for (; i > 0; i -= 1) { | ||
| tq.enqueue({rotorSpeed : i}, 1000); | ||
| } | ||
| tq.enqueue({reset : true}, 0); | ||
| }); |
+8
| ## Pending work | ||
| * Test streaming interface for use with joystick controller. | ||
| * Add high-level commands: | ||
| * launch | ||
| * hover | ||
| * land | ||
| * make hover point configurable |
+11
-3
@@ -82,7 +82,15 @@ 'use strict'; | ||
| if (!this.writable) return console.error("Attempted to write to closed command channel"); | ||
| if (!command) command = {}; | ||
| var b = new Command(command).toBuffer(); | ||
| this.emit('sent', command); | ||
| if (command.reset) { | ||
| this.sendReset(); | ||
| return true; | ||
| } | ||
| else { | ||
| var b = new Command(command).toBuffer(); | ||
| this.emit('sent', command); | ||
| this.connection.write(b); | ||
| return true; | ||
| return true; | ||
| } | ||
| }; | ||
@@ -89,0 +97,0 @@ |
+1
-1
| { | ||
| "name": "wifli", | ||
| "version": "0.3.0", | ||
| "version": "0.3.1", | ||
| "author": { | ||
@@ -5,0 +5,0 @@ "name": "Forrest L Norvell", |
+6
-3
| ## What is? | ||
| Interactive Toy Concepts makes this thing called a [Wi-Fly](http://www.interactivetoy.com/IATC1011/home/index.html). JIFASNIF, therefore here's a pretty simpleminded wrapper in Node to control the copter. | ||
| Interactive Toy Concepts makes this thing called a | ||
| [Wi-Fly](http://www.interactivetoy.com/IATC1011/home/index.html). JIFASNIF, | ||
| therefore here's an increasingly less simpleminded wrapper in Node to control | ||
| the copter. | ||
| ## Prerequisites | ||
| You'll need to already have the controlling PC on the SSID for the Wi-Fly. | ||
| You'll need to already have the controlling computer on the SSID for the Wi-Fly. | ||
| That's about it! For now, read the source for the details, or look at the | ||
| trivial example in the examples folder. | ||
| examples and tests. |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
9664
11.48%12
20%291
13.23%13
30%