i'm trying modify part of strandtest code can kind of below picture. want have 1 string of leds in circle programmed light starting @ 1 point, have next points @ either side come on (while keeping previous 1 on, colorwipe does), , continue until meet again @ opposite end of circle. how code modified that?
code: [select]
void loop() {
// example procedures showing how display pixels:
colorwipe(strip.color(255, 0, 0), 50); // red
colorwipe(strip.color(0, 255, 0), 50); // green
colorwipe(strip.color(0, 0, 255), 50); // blue
// fill dots 1 after other color
void colorwipe(uint32_t c, uint8_t wait) {
for(uint16_t i=0; i<strip.numpixels(); i++) {
strip.setpixelcolor(i, c);
strip.show();
delay(wait);
}
}
code: [select]
int startpixel = whatever;
strip.setpixelcolor((startpixel, c); // first pixel
strip.show();
delay(wait);
for(uint16_t i=1; i<=strip.numpixels()/2; i++) { // half many loops
strip.setpixelcolor((startpixel+i) % strip.numpixels, c); //one direction, wrap
strip.setpixelcolor((startpixel+strip.numpixels-i) % strip.numpixels, c); // other direction.
strip.show();
delay(wait);
}
}
so if started @ 10 in circle of 12, loop should 11, 12, 0, 1, 2, 3
and 9 ((10+12 -1) % 12), 8, 7, 6, 5, 4
Arduino Forum > Using Arduino > Programming Questions > Modifying void colorWipe's code
arduino
Comments
Post a Comment