hybridgroup / cylon-sphero-ble

Cylon.js driver for the Sphero BB-8 & Sphero Ollie robots
http://cylonjs.com
Other
27 stars 7 forks source link

Multiple Sphero SPRK+ #14

Open Robbert96 opened 6 years ago

Robbert96 commented 6 years ago

Hi, I'm trying to control two Sphero SPRK+ robots using JS. I use the cylon-sphero-ble module, which works great for 1 sprk+, but if I try to make two connections, it just gets stuck at "Starting connections". I've attached my Javasript code and the command window output. i'm using a usb 4.0 dongle

This is the code I use. If I comment out the second connection 'bluetooth2' and the second device, it works fine

var Cylon = require('cylon');

Cylon.robot({
    connections: {
      bluetooth: { adaptor: 'ble', uuid: 'c3b6877b2bc7', module: 'cylon-ble' },
      //bluetooth2: { adaptor: 'ble', uuid: 'ec2757f8d049', module: 'cylon-ble' },
     },

    devices: {
        bb8: { driver: 'bb8', module: 'cylon-sphero-ble' , connection: 'bluetooth'}
      //bb9: { driver: 'bb8', module: 'cylon-sphero-ble', connection: 'bluetooth2' }

    },

    work: function (my) {
        my.bb8.color(0x00FFFF);

        after(500, function () {
            my.bb8.color(0xFF0000);
        });

        after(1000, function () {
            my.bb8.roll(60, 0);
        });

        after(2000, function () {
            my.bb8.roll(60, 180);
        });

        after(3000, function () {
            my.bb8.stop();
        });
    }
}).start();

In my command window, the following shows up, but it doesn't continue to 'Starting devices': `C:\Users\robbe_000\Desktop\noble-master\noble-master\Sphero>node cylontest2.js

2017-11-01T13:31:08.196Z : [Robot 1] - Starting connections.

2017-11-01T13:31:08.198Z : [Robot 1] - Starting connection 'bluetooth'.

2017-11-01T13:31:08.199Z : [Robot 1] - Starting connection 'bluetooth2'.`

Does anyone know how to fix this? Thanks in advance!

gazialankus commented 6 years ago

I could not make multiple Sprk+s work with cylon. I ended up using https://github.com/orbotix/sphero.js and at some point I had two Sprk+s were running fine with it.