Skip to content

Instantly share code, notes, and snippets.

@ReidCarlberg
Created March 19, 2014 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ReidCarlberg/9644926 to your computer and use it in GitHub Desktop.
Save ReidCarlberg/9644926 to your computer and use it in GitHub Desktop.
var http = require("http");
var Cylon = require('cylon');
var copter1 = Cylon.robot({
connection: {name: 'ardrone', adaptor: 'ardrone', port: '192.168.1.1'},
device: {name: 'drone', driver: 'ardrone'},
reidStart: function(my) {
console.log("reidStart");
my.drone.takeoff();
},
reidStop: function(my) {
console.log("reidStop");
my.drone.land();
my.drone.stop();
},
work: function(my) {
console.log("work");
//former body
}
});
copter1.start();
http.createServer(function(req,res) {
console.log("have a request");
//console.log(copter1);
console.log(copter1.robot);
if (req.url == "/start") {
console.log("ready to start");
copter1.connections['ardrone'].takeoff();
} else if (req.url == "/stop") {
console.log("ready to stop");
copter1.connections['ardrone'].land();
}
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Executed');
}).listen(1337, "10.0.0.2");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment