NeoPixel library not outputting correctly

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
Zeloz
Posts: 10
Joined: 13 May 2022 01:30

NeoPixel library not outputting correctly

Post by Zeloz »

I followed the schematic in the examples for the NeoPixels to invert the signal. I have them hooked up and can produce some colors on the NeoPixel strip, however, the colors are not associated with pixel 1, pixel 2 and so forth. They appear to overlap, perhaps having the wrong buffer length per pixel? I have 4, triple color NeoPixels and here is the example code I am using:

#include "ZUNO_NeoPixel.h"

#define MAX_PIXELS 4 // NB! Z-Uno can not control more than 25 WS2811 without harming RF communications
#define PIXEL_SIZE 3 // Three colors per pixel
#define BUFF_SIZE (MAX_PIXELS * PIXEL_SIZE)

byte pixel_buff[BUFF_SIZE];

NeoPixel pixels(pixel_buff, BUFF_SIZE);

void setup() {
pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
pixels.clear(); // Set all pixel colors to 'off'
}

void loop() {
for(int i=0; i<254; i++) {
pixels.setPixelColor(1, pixels.Color(i, 0, 0));
delay(10);
pixels.show();
}
for(int i=0; i<254; i++) {
pixels.setPixelColor(1, pixels.Color(0, i, 0));
delay(10);
pixels.show();
}
for(int i=0; i<254; i++) {
pixels.setPixelColor(1, pixels.Color(0, 0, i));
delay(10);
pixels.show();
}
pixels.clear();
delay(5000);
}

With this code, the second pixel on the strip goes red, then blue, and then the third pixel goes green when it should only be modifying the second pixel. Also, the pixels.clear(); doesn't clear the first pixel if a color has been put on that. Is there something I can change or some other place to define the buffer?
Zeloz
Posts: 10
Joined: 13 May 2022 01:30

Re: NeoPixel library not outputting correctly

Post by Zeloz »

This was for the Z-Uno G1. When trying to run the example for G2 I get:
'NeoPixel' does not name a type
p0lyg0n1
Posts: 242
Joined: 04 Aug 2016 07:14

Re: NeoPixel library not outputting correctly

Post by p0lyg0n1 »

Hi,
The API has changed since the first version. Now the library supports the ability to work with several tapes at once. Try the examples that come with the Z-Uno core (see the screenshot). Good luck.

Best regards,
Alex.
Attachments
SCNeo.png
SCNeo.png (203.86 KiB) Viewed 1756 times
Zeloz
Posts: 10
Joined: 13 May 2022 01:30

Re: NeoPixel library not outputting correctly

Post by Zeloz »

Thanks, the example works for the G2
Post Reply