Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connect loop #31

Open
syco opened this issue Mar 7, 2023 · 0 comments
Open

connect loop #31

syco opened this issue Mar 7, 2023 · 0 comments

Comments

@syco
Copy link

syco commented Mar 7, 2023

Hi,
I've put together this script to test the light, but I get this output and no light at all:

require('busylight').devices(true);

const bl = require('busylight').get(1);

console.log(bl);

bl.on('disconnected', function (err) {
  console.log("BL disconnected");
  console.log(err);
});

bl.on('connected', function () {
  if (!bl) {
    return console.log('no busylight found');
  }

  bl.defaults({
    keepalive: true, // If the busylight is not kept alive it will turn off after 30 seconds
    color: 'white', // The default color to use for light, blink and pulse
    duration: 100000000, // The duration for a blink or pulse sequence
    rate: 300, // The rate at which to blink or pulse
    degamma: true, // Fix rgb colors to present a better light
    tone: 'Quiet', // Default ring tone
    volume: 0 // Default volume
  });

  console.log("BL connected");
  bl.light('red');
});
$ sudo node exec.js
Busylight {
  _events: [Object: null prototype] {},
  _eventsCount: 0,
  _maxListeners: undefined,
  options: 1,
  buffer: [
      0,  16,   0, 0,   0, 0, 0, 0, 128, 0, 0,   0,
      0,   0,   0, 0,   0, 0, 0, 0,   0, 0, 0,   0,
      0,   0,   0, 0,   0, 0, 0, 0,   0, 0, 0,   0,
      0,   0,   0, 0,   0, 0, 0, 0,   0, 0, 0,   0,
      0,   0,   0, 0,   0, 0, 0, 0,   0, 0, 0, 255,
    255, 255, 255, 6, 147
  ],
  newProtocol: 10171,
  debug: false,
  connectAttempts: 0,
  getColorArray: [Function (anonymous)],
  _defaults: {
    keepalive: true,
    color: [ 255, 255, 255 ],
    rate: 300,
    degamma: true,
    tone: 'OpenOffice',
    volume: 4
  },
  [Symbol(kCapture)]: false
}
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
BL connected
...
...
...

Any idea why?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant