Fly and Control a Drone Using JavaScript

Whilst the video is only a sneak peek of a Code School tutorial, you can puzzle the pieces together yourself. The key part is the rolling-spider Node package which uses Bluetooth to communicate with the drone.

var RollingSpider = require('rolling-spider');
var temporal = require('temporal');
var rollingSpider = new RollingSpider({
    uuid: 'Mambo_434915'
});

rollingSpider.connect(function() {
  rollingSpider.setup(function() {
    rollingSpider.flatTrim();
    rollingSpider.startPing();
    rollingSpider.flatTrim();

    temporal.queue([
      {
        delay: 5000,
        task: function () {
          rollingSpider.takeOff();
          rollingSpider.flatTrim();
        }
      },
      {
        delay: 3000,
        task: function () {
          rollingSpider.forward({steps: 12});
        }
      },
      {
        delay: 5000,
        task: function () {
          rollingSpider.land();
        }
      },
      {
        delay: 5000,
        task: function () {
          temporal.clear();
          process.exit(0);
        }
      }
    ]);
  });
});

Flying a drone using JavaScript →
rolling-spider (GitHub) →

Quite sure this can be rebuilt using the Web Bluetooth API, bypassing the need for a Node server.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.