node-pixel icon indicating copy to clipboard operation
node-pixel copied to clipboard

Named pixel color does not work reliably

Open djipco opened this issue 8 years ago • 0 comments

Hi,

I stumbled upon an interesting issue. If you run the following code (Neopixel strip + Johnny-Five + Firmata, no backpack), you will see that using "red" as the color name works normally while using "green" does not.

var pixel = require("node-pixel");
var five = require("johnny-five");

var board = new five.Board();
var strip;
var index = 0;

board.on("ready", function() {

  strip = new pixel.Strip({
    board: this,
    controller: "FIRMATA",
    strips: [ {pin: 6, length: 30} ],
    gamma: 2.8
  });

  strip.on("ready", function() {

    setInterval(function () {

      strip.color("#000");

      strip.pixel(index).color("green");              // this does not work!!!
      // strip.pixel(index).color("red");             // this works
      // strip.pixel(index).color("#080");            // this works
      // strip.pixel(index).color("rgb(0, 128, 0)");  // this works

      strip.show();

      if (++index >= strip.length) index = 0;

    }, 100);

  });

});

When using "green", the first LED flashes green, then the second one flashes a very faint green and then nothing...

P.S. I just started using it but I love what you have done with this library. Cheers!

djipco avatar Oct 13 '17 01:10 djipco