Created
March 19, 2014 16:00
-
-
Save ReidCarlberg/9644926 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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