nerf-turret
v0.0.6
Published
nerf turret api
Downloads
7
Readme
NodeJS nerf turret api
Compatible with the Dream Cheeky 908 model.
Install
$ npm install --save nerf-turret
Usage
var nerfTurret = require('nerf-turret'),
turret = new nerfTurret.Turret();
turret.on('ready', function () {
turret.left();
setTimeout(turret.stop, 500);
setTimeout(turret.fire, 500);
//possible commands are:
//turret.left();
//turret.right();
//turrent.up();
//turret.down();
//turret.stop();
//turret.fire();
});
Pairing with a remote turret: You can use a socket.io server to pair with a remote turret, you will need a listener script connected to both the socket and the turrent and a remote script connected to the socket: Example Listener:
var nerfTurret = require('nerf-turret'),
turret = new nerfTurret.Turret({
socketServer:'http://localhost:9000/',
listening: true
});
console.log('I am listening');
Example remote turret usage:
var nerfTurret = require('nerf-turret'),
turret = new nerfTurret.Turret({
socketServer:'http://localhost:9000/'
});
turret.on('ready', function () {
turret.left();
setTimeout(turret.stop, 500);
setTimeout(turret.fire, 500);
});