Skip to content

Instantly share code, notes, and snippets.

@jakswa
Last active August 28, 2019 15:19
Show Gist options
  • Save jakswa/6d607ceb130ace7f3d0c to your computer and use it in GitHub Desktop.
Save jakswa/6d607ceb130ace7f3d0c to your computer and use it in GitHub Desktop.

Install needed node packages:

npm install -g cylon-ble
npm install cylon cylon-ollie

First scan for your BB8 (the device name should contain BB in it):

> sudo cylon-ble-scan
[...]
Peripheral discovered!
  Name: BB-3B29
  UUID: 161205d4f3a04149a1ea82762d30fd86
  rssi: -63

Then take its UUID and plop it in the bluetooth section of this, and you can run it:

var Cylon = require('cylon');

Cylon.robot({
  connections: {
    bluetooth: { adaptor: 'central', uuid: '161205d4f3a04149a1ea82762d30fd86', module: 'cylon-ble'}
  },

  devices: {
    ollie: { driver: 'ollie'}
  },

  work: function(my) {
    my.ollie.wake(function(err, data){
      console.log("wake");

      after(200, function() {
        my.ollie.setRGB(0x00FFFF);
      });

      after(500, function() {
        my.ollie.setRGB(0xFF0000);
        my.ollie.roll(60, 0, 1);

        after(1000, function(){
          my.ollie.roll(60, 90, 1);

          after(1000, function(){
            my.ollie.stop();
          });
        });
      });
    });
  }
}).start();
@thespacecowboys45
Copy link

Does this work? I have a mac and installed using 'npm' but I only got to 'starting scan.' and then nothing else.

I even brought up the BB8 app on my iPhone to wake up the robot, but no results with the scan program.

@yashsway
Copy link

Does this work? I have a mac and installed using 'npm' but I only got to 'starting scan.' and then nothing else.

I even brought up the BB8 app on my iPhone to wake up the robot, but no results with the scan program.

I have the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment