Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 07 23:44
    dependabot[bot] labeled #282
  • Dec 07 23:44
    dependabot[bot] assigned #282
  • Dec 07 23:44
    dependabot[bot] review_requested #282
  • Dec 07 23:44
    dependabot[bot] opened #282
  • Dec 07 23:44

    dependabot[bot] on npm_and_yarn

    chore: bump eslint from 8.4.0 t… (compare)

  • Dec 06 19:36

    dependabot[bot] on npm_and_yarn

    (compare)

  • Dec 06 19:36

    dependabot[bot] on master

    chore: bump eslint from 8.3.0 t… Merge pull request #281 from aj… (compare)

  • Dec 06 19:36
    dependabot[bot] closed #281
  • Dec 06 19:36
    ajfisher commented #281
  • Dec 06 19:04
    dependabot[bot] assigned #281
  • Dec 06 19:04
    dependabot[bot] review_requested #281
  • Dec 06 19:04
    dependabot[bot] labeled #281
  • Dec 06 19:04
    dependabot[bot] opened #281
  • Dec 06 19:04

    dependabot[bot] on npm_and_yarn

    chore: bump eslint from 8.3.0 t… (compare)

  • Dec 03 22:32

    dependabot[bot] on master

    chore: bump color-string from 1… Merge pull request #280 from aj… (compare)

  • Dec 03 22:32

    dependabot[bot] on npm_and_yarn

    (compare)

  • Dec 03 22:32
    dependabot[bot] closed #280
  • Dec 03 22:32
    ajfisher commented #280
  • Dec 03 19:05
    dependabot[bot] assigned #280
  • Dec 03 19:05
    dependabot[bot] review_requested #280
ajfisher
@ajfisher
Apologies for tardiness on reply - I did see this yesterday but we're mid cut-over week on site launch! Love the gif and reflection in the mirror.
So I don't have any of those LEDs to play with but if you change the byte order in nodepixel config did that fix it for you?
ajfisher
@ajfisher

nvm you probably can't fix that until you pad out the white channel. You could potentially hack that in the firmware to simply pad that byte with a zero for the moment.

In theory if you bump this to 4 it should pad out the last byte as well.

https://github.com/ajfisher/node-pixel/blob/master/firmware/src/libs/ws2812/ws2812.cpp#L15

Eric Brearley
@ebrearley

No probs! I'm enjoying it! I'll try to implement it nicely tonight if I have time (instead of hacking it in) and send you a pull request. But i might resort to the hack on account of not really understanding a great deal of what I'm doing.

I was thinking of comparing the latest adafruit library and porting across node-pixel again to update it. I wouldn't mind the setBrightness() method. Although I'm sure it's not included already for a good reason.

Eric Brearley
@ebrearley
Okay I was a touch ambitious, but making progress non the less. I need to find out how to do a few basic things, like get a log out from the formata to see the args as they flow through. What I do have is blue and green led's lighting up, but nothing else exciting. I'll push what I've done so you can have a looksie.
Eric Brearley
@ebrearley
Okay here's my start ajfisher/node-pixel#101
Jordana
@JordanaHarrison
Hello, does anyone know of a way to animate through pixel brightness with this library? I don't see any built-in thing in the docs. I'd like to do a pulsing animation, but want to see if there's a way beyond just decrementing the RGB values. Thanks!
Luis Montes
@monteslu
@ajfisher the Melbourne event isnt on the nodebotsday repo
possumus
@possumus
@ajfisher Can I use an Adafruit Trinket as the I2C backpack?
ajfisher
@ajfisher
@possumus sort of - you can give it a go but debugging is hard on a trinket. I actually started with the trinket as my backpack but lack of serial port for debugging just made it really, really hard.
Also because they aren't really designed for any serial interfaces they use this weird thing called USI which means your I2C comms can get a bit iffy. My suggestion is that if you have time just order a cheap Nano or Pro Mini from ebay for a few $$ and you'll get something very useful in a tiny form factor.
possumus
@possumus
@ajfisher Thanks a lot for getting back to me! I had a Trinket lying around and thought it would be a quick hack. I just ordered Nano! Will keep you posted and thanks again for the great library :)
possumus
@possumus

@ajfisher Hi again! So I got my hands on a nano and followed the "I2C Backpack Installation" by installing the Arduino IDE, then uploading the backpack.ino (found in nedo-pixel/firmware/build/backpack). Then I ran the johnnyfive-i2c.js from the examples folder. Here is what I get:
1502418425559 Available /dev/ttyUSB0
1502418425611 Connected /dev/ttyUSB0
1502418435621 Device or Firmware Error A timeout occurred while connecting to the Board.

Please check that you've properly flashed the board with the correct firmware.
See: https://github.com/rwaldron/johnny-five/wiki/Getting-Started#trouble-shooting

If connecting to a Leonardo or Leonardo clone, press the 'Reset' button on the board, wait approximately 11 seconds for complete reset, then run your program again.
events.js:165
throw err;
^

Error: Uncaught, unspecified "error" event. ([object Object])
at Board.emit (events.js:163:17)
at Board.log (/home/pi/Workspace/neoPixelTest/node-pixel/node_modules/johnny-five/lib/board.js:635:8)
at Board.(anonymous function) [as error] (/home/pi/Workspace/neoPixelTest/node-pixel/node_modules/johnny-five/lib/board.js:646:14)
at Board.<anonymous> (/home/pi/Workspace/neoPixelTest/node-pixel/node_modules/johnny-five/lib/board.js:390:14)
at ontimeout (timers.js:386:14)
at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5)

I found a similar post in the issue list which dealing with the Frimata on an Uno and not the backpack. Could you please help us?

Rajesh
@Rajesh_YRe_twitter
@ajfisher / all I am using the rainbow-dynamic.js example. I have exported the symbols and am invoking these functions from another js instance. This works fine. I can run the rainbow program but when I invoke a strip.off() or using strip.pixel(x).color it doesn't work till the previous color pattern is completed.
is there any way to immediately stop the pattern
@possumus I too have the same problem. This means that the board is not able communicate with pixel. Try to load a blank loop from the Arduino ide. After that retry the interchange step. It is a bit of struggle.
ajfisher
@ajfisher
@possumus So don't forget a backpack is to connect to another device over I2C. See this doc / diagram for some additional info: https://github.com/ajfisher/node-pixel/blob/master/docs/johnnyfive-i2c.md
@Rajesh_YRe_twitter Can you show me some code that you're trying to run here? That dynamic rainbow uses an interval to update the colour cycle. All you should need to do is stop the interval from running and then send the strip.off() command
Rajesh
@Rajesh_YRe_twitter
Below is the code

var strip_off = function()
{
console.log("[J5]:Led Stop called");
var led_counter = 0;

  if(rainbow_timer != null) { 
     stop_loop = "true"; 
     clearInterval(rainbow_timer); 
     rainbow_timer.unref();
  }
  for (;led_counter < LED_COUNT; ++led_counter)
      strip.pixel(led_counter).color("#000000");

  //strip.off();
  strip.show();
  board.io.reset();

}
function dynamicRainbow( delay ){
console.log( 'dynamicRainbow' );

    var showColor;
    var cwi = 0; // colour wheel index (current position on colour wheel)
    rainbow_timer = setInterval(function(){
    console.log("Changing now!");
    if (++cwi > 255) {
          cwi = 0;
    }
    for(var i = 0; i < strip.length; i++) {
        showColor = colorWheel( ( cwi+i ) & 255 );
       strip.pixel( i ).color( showColor );
    }
    strip.show();
}, 1000/delay);

}

// Input a value 0 to 255 to get a color value.
// The colors are a transition r - g - b - back to r.

function colorWheel( WheelPos ){
var r,g,b;
WheelPos = 255 - WheelPos;

    if ( WheelPos < 85 ) {
        r = 255 - WheelPos * 3;
        g = 0;
        b = WheelPos * 3;
    } else if (WheelPos < 170) {
        WheelPos -= 85;
        r = 0;
        g = WheelPos * 3;
        b = 255 - WheelPos * 3;
    } else {
        WheelPos -= 170;
        r = WheelPos * 3;
        g = 255 - WheelPos * 3;
        b = 0;
    }
    // returns a string with the rgb value to be used as the parameter
    return "rgb(" + r +"," + g + "," + b + ")";

}
var strip_off = function()
{
console.log("[J5]:Led Stop called");
var led_counter = 0;

  if(rainbow_timer != null) { 
     stop_loop = "true"; 
     clearInterval(rainbow_timer); 
     rainbow_timer.unref();
  }
  for (;led_counter < LED_COUNT; ++led_counter)
      strip.pixel(led_counter).color("#000000");

  //strip.off();
  strip.show();
  board.io.reset();

}
function dynamicRainbow( delay ){
console.log( 'dynamicRainbow' );

    var showColor;
    var cwi = 0; // colour wheel index (current position on colour wheel)
    rainbow_timer = setInterval(function(){
    console.log("Changing now!");
    if (++cwi > 255) {
          cwi = 0;
    }
    for(var i = 0; i < strip.length; i++) {
        showColor = colorWheel( ( cwi+i ) & 255 );
       strip.pixel( i ).color( showColor );
    }
    strip.show();
}, 1000/delay);

}

// Input a value 0 to 255 to get a color value.
// The colors are a transition r - g - b - back to r.

function colorWheel( WheelPos ){
var r,g,b;
WheelPos = 255 - WheelPos;

    if ( WheelPos < 85 ) {
        r = 255 - WheelPos * 3;
        g = 0;
        b = WheelPos * 3;
    } else if (WheelPos < 170) {
        WheelPos -= 85;
        r = 0;
        g = WheelPos * 3;
        b = 255 - WheelPos * 3;
    } else {
        WheelPos -= 170;
        r = WheelPos * 3;
        g = 255 - WheelPos * 3;
        b = 0;
    }
    // returns a string with the rgb value to be used as the parameter
    return "rgb(" + r +"," + g + "," + b + ")";

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

console.log("Board ready, lets add light");

strip = new pixel.Strip({
data: 6,
length: LED_COUNT,
color_order: pixel.COLOR_ORDER.GRB,
board: this,
controller: "FIRMATA",
});

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

    console.log("Strip ready, let's go");

    var colors = ["red", "green", "blue", "yellow", "cyan", "magenta", "white"];
    //var current_colors = [0,1,2,3,4];
    var current_pos = [0,1,2,3,4];

    current_pos.forEach((pos) => {
        strip.pixel(pos).color(colors[pos]);
    });
    strip.show();


    /*current_pos.forEach((pos) => {
        strip.pixel(pos).color("#000

000");
});
strip.show();

    var blinker = setInterval(function() {

        strip.shift(1, pixel.FORWARD, true);

        strip.show();
    }, 1000/fps);*/
});
this.repl.inject({
         strip: strip
});

});

exports.strip=strip;
exports.board=board;
exports.strip_on=strip_on;
exports.strip_off=strip_off;
exports.dynamicRainbow=dynamicRainbow;

I invoke dynamicRainbow, strip_off and strip_on from repl or otherwise
Rajesh
@Rajesh_YRe_twitter
from another script
Rajesh
@Rajesh_YRe_twitter
Also just wondering will a 144 led WS2812B strip be supported in firmata mode? Or should I switch to I2Cbackpack
Rajesh
@Rajesh_YRe_twitter
Tried the basic johnnyfive.js example also with the blinker if I leave it running for a few secs the whole Raspberry Pi hangs :worried:
ajfisher
@ajfisher
@Rajesh_YRe_twitter if you're on an RPi have you updated the I2C sync boot directive?
That code is a bit hard to follow due to the formatting from gitter. can you pop it in a Gist or Pastebin or something?

will a 144 led WS2812B strip be supported in firmata mode

Yes - you can have about 200 pixels

Jean-Philippe Côté
@djipco
Hey guys! Quick question: does node-pixel support RGBW Neopixels?
Jean-Philippe Côté
@djipco
On a related note, Adafruit says the following about the 60 LEDs ring: "May ship with either WS2812B or SK6812-based LEDs." Will it work with node-pixel if I receive the SK6812 ?
Jean-Philippe Côté
@djipco
I got my answer regarding RGBW Neopixels. They do not work. Are there any plans to support them? I see there is a PR (ajfisher/node-pixel#101) but work seems to have stopped...
@ajfisher Adafruit says their Neopixels "may ship with either WS2812B or SK6812" chipsets. If I receive a unit that uses the SK6812, will it work with node-pixel?
Jean-Philippe Côté
@djipco
I don't mean to be rude but does anybody know if this project is still being maintained?
ajfisher
@ajfisher

@cotejp apologies - I've been away so haven't had a chance to answer any of this.

Re project being maintained. Yes the project is still being maintained but the velocity is low. I have other priorities at the moment and NodePixel does 95% of what I need it to do so most development is based on what needs people have which then drives changes & commits. If you're keen to have RGBW support then there is an outline of the way it would need to be implemented here: https://github.com/ajfisher/node-pixel/issues/64#issuecomment-243289715

This work hasn't been completed but I'd be happy to include it if someone's willing to do it. It's also non-trivial to make this work properly which is why I don't think anyone has tackled it to completion.

Regarding SK6812 - I don't have any of these to test with however the protocol is largely the same so it should work. If it doesn't it will be relatively straightforward to implement. Again if someone wants to get some, test them and submit a PR then I'm more than happy to include it.

Jean-Philippe Côté
@djipco
@ajfisher Okay, thanks. Regarding SK6812, according to Adafruit, most (all?) of their new units now use SK6812. The one I received a few days ago does work with node-pixel. It's probably using SK6812 but I do not know how to confirm that.
Support for RGBW would be awesome but I don't think I'll have have to dive in and contribute.
*have time
Joel Gullander
@Joelgullander

I am trying to create a list of pixel.Strips and im defining it as stated below:
var strips = new pixel.Strip({
board: this,
controller: "FIRMATA",
strips: [ {pin: 2, length: 4}, {pin:3, length:4 }, ],
gamma: 2.8,
})

only way to light up those strips is by doing strips.show(), but if I want to show only the pin 2 strip how would I do that?

What im trying to accomplish is lighting up pin 2 strip and after 1 sec delay light up pin 3 strip
ajfisher
@ajfisher

@Joelgullander there's a couple of ways to achieve this.

In defining the strip the way you have you're effectively saying "compose all of these strips into one bigger strip". This is really helpful to deal with latency on longer strips because you have to push the pixels sequentially into them. Splitting to smaller ones means you can target your writes a little more effectively and get better throughput.

As such what happens is that pixels 0-3 are on pin 2 and then pixels 4-7 are on pin 3.

So you can do something like this:


for (let i=0; i< 4; i++) {
  strips.pixel(i).color("ff0000");
}

strips.show();

setTimeout(() => { 
  for (let i=4; i< 8; i++) {
    strips.pixel(i).color("ff0000");
  }
}, 1000);

The other option is define 2 Strip objects on separate pins and then control them independently from each other.

NunnoXYZ
@nunnoXYZ
hello !
hey guys can someone point me out a way or a tutorial to get working with a 4 pin led strip (5050) ?
NunnoXYZ
@nunnoXYZ
ajfisher
@ajfisher
@nunnoXYZ This type of strip isn't supported by this library. You can drive it simply using a standard RGB LED object from nodebots.
Norberto Purtschert
@npurtschert
Hi. Is there the posibility to use this library in another HW like an UP box? Check here ;) http://www.up-board.org/upsquared/
carloposo
@carloposo
What version on Node is node-pixel compatible with?
carloposo
@carloposo
Is there a possibility to destroy the USB of the Mac if fps are too high?
Benjamin E. Coe
@bcoe
anyone kicking around? I'm attempting to connect to an Arduino Micro, from a raspberry pi, over usb, with the firmata installed.
the connection seems to hang indefinitely.
Benjamin E. Coe
@bcoe
got it working, I think the baud rate needed to be 28800 in the firmata software)