Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 26 21:44

    dependabot[bot] on npm_and_yarn

    (compare)

  • Nov 26 21:44

    dependabot[bot] on master

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

  • Nov 26 21:44
    dependabot[bot] closed #277
  • Nov 26 21:44
    ajfisher commented #277
  • Nov 26 19:03
    dependabot[bot] assigned #277
  • Nov 26 19:03
    dependabot[bot] review_requested #277
  • Nov 26 19:03
    dependabot[bot] labeled #277
  • Nov 26 19:03
    dependabot[bot] opened #277
  • Nov 26 19:03

    dependabot[bot] on npm_and_yarn

    chore: bump color-string from 1… (compare)

  • Nov 23 01:05

    dependabot[bot] on npm_and_yarn

    (compare)

  • Nov 23 01:05

    dependabot[bot] on master

    chore: bump eslint from 8.2.0 t… Merge pull request #276 from aj… (compare)

  • Nov 23 01:05
    dependabot[bot] closed #276
  • Nov 23 01:04
    ajfisher commented #276
  • Nov 22 19:06
    dependabot[bot] assigned #276
  • Nov 22 19:06
    dependabot[bot] review_requested #276
  • Nov 22 19:06
    dependabot[bot] labeled #276
  • Nov 22 19:06
    dependabot[bot] opened #276
  • Nov 22 19:06

    dependabot[bot] on npm_and_yarn

    chore: bump eslint from 8.2.0 t… (compare)

  • Nov 12 04:40
    ajfisher commented #275
  • Nov 12 04:11
    mahdaen opened #275
ajfisher
@ajfisher
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)
ajfisher
@ajfisher
@bcoe that seems a bit odd. Not sure why the baud rate was set that slow?
keaixx365
@keaixx365
Anyone here
keaixx365
@keaixx365
@ajfisher It runs into error when flash Backpack using "interchange install git+https://github.com/ajfisher/node-pixel -a nano", Error: Sending 3020: receiveData timeout after 400ms.
@ajfisher any idea on this error?
keaixx365
@keaixx365
@ajfisher is this tool possible to support more than 1000 leds?
Nuno Marujo
@nhmarujo
Hi everyone. Is it possible to set individual brightness levels when using a strip?
I mean, define brightness per led
Eric Johnson
@ericdjohnson_twitter
Hi all, I ran into an error when trying to connect my strip of WS2812b LEDs to my Raspberry Pi 4: 1583152030510 Board No connected device found How do I go about debugging this? I was able to get node-red's neopixel node working and able to control my strip.
Abhishek Chaudhary
@theabbie
LooLooAsuna
@LooLooAsuna
whats the best way to change the brightness of the leds