-
-
Save deadprogram/0d40a44cdee0ba124f43 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Cylon = require('cylon'); | |
Cylon.api({ | |
host: '0.0.0.0', | |
port: '7000', | |
ssl: false | |
}); | |
Cylon.robot({ | |
name: 'drenerdo', | |
connections: { | |
pebble: { adaptor: 'pebble' }, | |
ardrone: { adaptor: 'ardrone', port: '192.168.1.1'} | |
}, | |
devices: { | |
pebble: { driver: 'pebble', connection: 'pebble' }, | |
drone: { driver: 'ardrone', connection: 'ardrone' } | |
}, | |
work: function(my) { | |
my.pebble.pending_message("Starting Drone Awesomeness"); | |
my.pebble.on('button', function(data){ | |
console.log("Button pushed:" + data); | |
if(data.localeCompare('up')===0) { | |
my.drone.animateLeds('blinkGreenRed'); | |
my.drone.takeoff(); | |
return; | |
} | |
my.drone.animateLeds('fire', 5, 2); | |
my.drone.land(); | |
my.drone.stop(); | |
return; | |
}); | |
my.pebble.on('tap', function() { | |
console.log("Tap event detected!"); | |
}); | |
} | |
}).start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment