In case of TLDR, we're going to Tarantino this and start at the end.
My question is: Where is the actual value associated with each color? e.g. "16711935", or "0xFF00FF"?
Now the relevant info:
The following code is from Overview | Multi-tasking the Arduino - Part 3 | Adafruit Learning System
A class definition is given:
#include <Adafruit_NeoPixel.h>
// Pattern types supported:
enum pattern { NONE, RAINBOW_CYCLE, THEATER_CHASE, COLOR_WIPE, SCANNER, FADE };
// Patern directions supported:
enum direction { FORWARD, REVERSE };
// NeoPattern Class - derived from the Adafruit_NeoPixel class
class NeoPatterns : public Adafruit_NeoPixel
{
public:
// Member Variables:
pattern ActivePattern; // which pattern is running
direction Direction; // direction to run the pattern
unsigned long Interval; // milliseconds between updates
unsigned long lastUpdate; // last update of position
uint32_t Color1, Color2; // What colors are in use
uint16_t TotalSteps; // total number of steps in the pattern
uint16_t Index; // current step within the pattern
void (*OnComplete)(); // Callback on completion of pattern
Then later a function is created using the class definition, but then then Color1 is only defined as "color"? Am I reading that right?
// Initialize for a ColorWipe
void ColorWipe(uint32_t color, uint8_t interval, direction dir = FORWARD)
{
ActivePattern = COLOR_WIPE;
Interval = interval;
TotalSteps = numPixels();
Color1 = color;
Index = 0;
Direction = dir;
}
Now the background if you care to know:
I am beginning a project using some cool white neopixels from adafruit. To try and make the code behave the way I want I am moving away from delays and trying to use a State Machine approach. Using this guide I think I get the jist of how classes, constructors and functions work together:
But when the author moves into part 2 he gets into interrupts and I start to lose him. No big deal, I can come back to that, I want to start with the part 1 stuff first.
But pressing on to part 3, where it is applied to neopixels, I lose him completely as far as how the variables, constructors and functions relate back to the original class definition.
Maybe it's not the code itself, but the neopixel angle that is confusing me. Between the pixels and the code I'm about to go blind from staring at these things anyway, they are burning out my retinas.