Created
March 25, 2014 23:50
-
-
Save drGrove/9773987 to your computer and use it in GitHub Desktop.
[wearscript] Crazyflie Glass Driver
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
| <html style="width:100%; height:100%; overflow:hidden"> | |
| <head> | |
| <!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>--> | |
| <script data-require="jquery" data-semver="2.0.3" src="http://code.jquery.com/jquery-2.0.3.min.js"></script> | |
| </head> | |
| <body style="width:100%; height:100%; overflow:hidden; margin:0"> | |
| <canvas id="canvas" width="640" height="360" style="display:block"></canvas> | |
| <script> | |
| WS.log('Wearscript CrazyFlie Driver'); | |
| WS.say('Wearscript CrazyFlie Driver'); | |
| WS.sound('SUCCESS'); | |
| var nodeServerURL = 'http://192.168.1.142:9999/' // <---Change This | |
| function doCommand(command){ | |
| $.get(nodeServerURL + command) | |
| } | |
| WS.gestureCallback('onGesture', function (name) { | |
| if(name == 'TAP'){ | |
| doCommand('takeoff') | |
| WS.say('Taking Off') | |
| } | |
| if(name == 'TWO_TAP'){ | |
| doCommand('land') | |
| WS.say('preparing to land') | |
| } | |
| }); | |
| WS.gestureCallback('onGestureSWIPE_LEFT', function () { | |
| doCommand('hover') | |
| WS.say('hovering') | |
| }); | |
| WS.gestureCallback('onGestureSWIPE_RIGHT', function () { | |
| doCommand('off') | |
| WS.say('Motors Off') | |
| }); | |
| </script> | |
| </body> | |
| </html> |
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
| {"name":""} |
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'); | |
| var express = require('express') | |
| var app = express(); | |
| Cylon.robot({ | |
| connection: { name: 'crazyflie', adaptor: 'crazyflie', port: 'radio://1/10/250KPS' }, | |
| device: {name: 'drone', driver: 'crazyflie'}, | |
| work: function(my) { | |
| my.drone.on('start', function() { | |
| app.get('/takeoff', function(){ | |
| my.drone.takeoff(); | |
| }) | |
| app.get('/land', function(){ | |
| my.drone.land(); | |
| }) | |
| app.get('/hover', function(){ | |
| my.drone.hover(); | |
| }) | |
| app.get('/off', function(){ | |
| my.drone.stop() | |
| }) | |
| app.listen(9999) | |
| }); | |
| } | |
| }).start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment