Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i want to run normal program with class type of program #10

Open
LedArts opened this issue Feb 10, 2017 · 0 comments
Open

i want to run normal program with class type of program #10

LedArts opened this issue Feb 10, 2017 · 0 comments

Comments

@LedArts
Copy link

LedArts commented Feb 10, 2017

NEED HELP
Can i run "class" code with normal example code.
i try but only one of them is running. what should i do please tell me.

class example
class colorWipe: public animation {
public:
colorWipe(void) { w = random(256); }
virtual void init(void);
virtual void show(void);
private:
byte w;
int index;
bool fwd;
};

void colorWipe::init(void) {
int p = random(2, 4);
w += p*16 + 1;
fwd = random(2);
index = 0;
if (!fwd) index = strip.numPixels() - 1;
}

void colorWipe::show(void) {
uint32_t color = Wheel(w);
if (fwd) {
if (index > int(strip.numPixels())) { // Start new sequence with the new color
init();
complete = true;
return;
}
strip.setPixelColor(index++, color);
} else {
if (index < 0) { // Start new sequence with the new color
init();
complete = true;
return;
}
strip.setPixelColor(index--, color);
}
complete = false;
}

Normal example
void theaterChase(uint32_t c, uint8_t wait) {
for (int j=0; j<10; j++) { //do 10 cycles of chasing
for (int q=0; q < 3; q++) {
for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
strip.setPixelColor(i+q, c); //turn every third pixel on
}
strip.show();

  delay(wait);

  for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
    strip.setPixelColor(i+q, 0);        //turn every third pixel off
  }
}

}
}

only mgr.show is running in this loop
void loop() {
mgr.show();
theaterChase(strip.Color(127, 127, 127), 50); // White
theaterChase(strip.Color(127, 0, 0), 50); // Red
theaterChase(strip.Color(0, 0, 127), 50); // Blue
}
what should i do please tell me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant