arminjo / neopatterns Goto Github PK
View Code? Open in Web Editor NEWPatterns for NeoPixel strips and matrixes including the patterns of the NeoPattern Example by Adafruit.
License: GNU General Public License v3.0
Patterns for NeoPixel strips and matrixes including the patterns of the NeoPattern Example by Adafruit.
License: GNU General Public License v3.0
Hi,
The NeoPixel.h library conflicts with the USB_Host_Shield_2.0 library. When I attempt to compile the project, I get a series of errors with the colors, White, Red, Green, and Blue. Here is an example:
In file included from C:\Users\timhe\Documents\Arduino\libraries\NeoPatterns\src/NeoPatterns.h:45:0,
from C:\Users\timhe\Documents\Arduino\Chopper-SHADOW\Chopper-SHADOW.ino:97:
C:\Users\timhe\Documents\Arduino\libraries\NeoPatterns\src/NeoPixel.h:60:28: error: 'uint8_t Red(color32_t)' redeclared as different kind of symbol
uint8_t Red(color32_t color);
^
In file included from C:\Users\timhe\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/PS3Enums.h:21:0,
from C:\Users\timhe\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/PS3BT.h:22,
from C:\Users\timhe\Documents\Arduino\Chopper-SHADOW\Chopper-SHADOW.ino:88:
C:\Users\timhe\Documents\Arduino\libraries\USB_Host_Shield_Library_2.0/controllerEnums.h:47:9: note: previous declaration 'ColorsEnum Red'
Red = 0xFF0000,
^~~
I was wondering if there was a way to resolve the issue. I am not a super strong programmer, so I don't know the correct term. But maybe the colors could be made an internal or private variable? My workaround for the last two years has been to modify the name in the NeoPixel.h code so the conflict goes away. The problem is when I update to the library I have to rehack the code.
Or is there another more elegant way for resolving this without changing the code in the library?
Thanks,
Tim
Line 91:
#define COLOR32_GET_BLUE(color) (color 0xFF)
should be:
#define COLOR32_GET_BLUE(color) (color & 0xFF)
I've used the 'Fade' function to create a 'Blink' effect.
Started effect with Fade from 'black' to 'White' and in the callback 'reverse colors to to from 'White' to 'Black' again.
Part of my callBack logic:
ledStripPtr->Fade(ledStripPtr->LongValue1.Color2, ledStripPtr->Color1, 64, speedDelay);
These colors (Color1 and Color2) do not seem to include the 'White' component.
Thank you for writing this library, it is very useful.
I am using five NeoPixels, each on a different pin. If I have more than one Fade() running at a time there will be a glitch where the color from one NoePixel will suddenly appear on a different NeoPixel for a moment at the beginning of a new Fade(). This seems like it might be a memory management issue? Maybe there is a shared resource somewhere that is accidentally being referenced?
Hello Armin!
Let me first say the library looks amazing, I've been helping my cousin set her neomatrix up and playing around with it and it has been super easy to set up with the snake game after copying all the library files.
We are having one problem though. After hooking up the buttons and setting the right pins we can't get the 2 button mode to work. If we start the Arduino it seems like the button presses are not being picked up. After Serial.printing the state of the button I can see the inputs are being registered in code, but I can't find where the library handles the button pressess. I can see the sButtonWasPressed
variable but can't see where/if this var is updated with the button pressed anywhere. If you have some time and can clear this up for us it would be great.
Thanks again!
Matias
Hi Armin! Vale from Uruguay here!
Im having trouble with the new code to set up a lower Brightness in the Snake. I installed the new update on the libraries but I think it's not recognizing the MatrixSnake.hpp and the other libraries with hpp. Do I have to do something different rather than changing the h for hpp?
Thank you!
Hi, I have five NeoPixel rings with 8 LEDs on each ring. I am going to wire the rings together so they all run off of one pin as the plane where they will be installed is tight and it would be tough to send wires to a pin on the Arduino for each ring. I've tried to setup a test of this using the AllPatternsOnMultipleDevices example as a basis for my project. It's a short sketch. However, I get a
"variable or field 'PatternHandler' declared void" error when I try to compile. What am I doing wrong?
`#include <Arduino.h>
// Which pin on the Arduino is connected to the NeoPixels?
void PatternHandler(NeoPatterns *aLedsPtr);
#define PIN_NEOPIXEL_ALL 6
NeoPatterns allPixel = NeoPatterns(40, PIN_NEOPIXEL_ALL, NEO_GRB + NEO_KHZ800, &PatternHandler);
NeoPatterns ring1 = NeoPatterns(&allPixel, 0, 8, true, &PatternHandler);
NeoPatterns ring2 = NeoPatterns(&allPixel, 9, 8, true, &PatternHandler);
NeoPatterns ring3 = NeoPatterns(&allPixel, 18, 8, true, &PatternHandler);
NeoPatterns ring4 = NeoPatterns(&allPixel, 28, 8, true, &PatternHandler);
NeoPatterns ring5 = NeoPatterns(&allPixel, 37, 8, true, &PatternHandler);
void setup() {
Serial.begin(115200);
ring1.begin();
ring2.begin();
ring3.begin();
ring4.begin();
ring5.begin();
ring1.PixelFlags |= PIXEL_FLAG_GEOMETRY_CIRCLE;
ring2.PixelFlags |= PIXEL_FLAG_GEOMETRY_CIRCLE;
ring3.PixelFlags |= PIXEL_FLAG_GEOMETRY_CIRCLE;
ring4.PixelFlags |= PIXEL_FLAG_GEOMETRY_CIRCLE;
ring5.PixelFlags |= PIXEL_FLAG_GEOMETRY_CIRCLE;
delay(300); // to avoid partial patterns at power up
ring1.ColorWipe(COLOR32_PURPLE, 50);
ring2.ColorWipe(COLOR32_RED, 50);
ring3.ColorWipe(COLOR32_GREEN, 50);
ring4.ColorWipe(COLOR32_BLUE, 50);
ring5.ColorWipe(COLOR32_ORANGE, 50);
// bar24.ScannerExtended(COLOR32_BLUE, 5, 50, 1,
// FLAG_SCANNER_EXT_ROCKET | FLAG_SCANNER_EXT_VANISH_COMPLETE | FLAG_SCANNER_EXT_START_AT_BOTH_ENDS);
Serial.println("started");
}
void loop() {
ring1.update();
ring2.update();
ring3.update();
ring4.update();
ring5.update();
}
void PatternHandler(NeoPatterns *aLedsPtr) {
static int8_t sState = 0;
switch (sState) {
case 0:
aLedsPtr->ColorWipe(COLOR32_RED_HALF, 50);
break;
case 1:
aLedsPtr->Delay(500);
break;
case 2:
aLedsPtr->Heartbeat(COLOR32_GREEN, 50, 0);
break;
case 3:
aLedsPtr->Delay(500);
break;
case 4:
aLedsPtr->RainbowCycle(50, DIRECTION_UP);
break;
case 5:
aLedsPtr->RainbowCycle(50, DIRECTION_DOWN);
break;
case 6:
aLedsPtr->Delay(400);
break;
case 7:
aLedsPtr->Fire(20, 400); // OK Fire(30, 260)is also OK
break;
case 8:
// switch to random
initMultipleFallingStars(aLedsPtr, COLOR32_WHITE_HALF, 7, 30, 3, &allPatternsRandomHandler);
sState = -1; // Start from beginning
break;
default:
Serial.println("ERROR");
break;
}
Serial.print("PatterHandler: Pin=");
Serial.print(aLedsPtr->getPin());
Serial.print(" Length=");
Serial.print(aLedsPtr->numPixels());
Serial.print(" ActivePattern=");
aLedsPtr->printPatternName(aLedsPtr->ActivePattern, &Serial);
Serial.print("|");
Serial.print(aLedsPtr->ActivePattern);
Serial.print(" State=");
Serial.println(sState);
sState++;
}
`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.