Split/Dual “Cylon” Modification help plz…
—Back again to try something simple now that I have:
60/m ws2811’s 400Hz RGB strip
Uno R2
1A 5v PS or 2.2A LiPo 4.2v battery
also have the cap on PS line for LED’s. Resistor on Din., just in case.
I played around a bit with example code and now would like to do a mod to the Cylon code.
Instead of just one dot, I want two. Have both start at opposite ends of the 60 LED strip, go towards the middle, bounce back to the ends, then loop.
I would also like to add two pots.
- So far I have managed to add “Speed” as the value of a pot on A1, then divided it by 32 to limit the delay to a max value of 32. Works good enough, but wonder if it could be done any better.
- A pot to colorshift the dots. Either by morphing thru the spectrum or doing hard changes between colors as the dots pan across. Prefer to morph across the spectrum.
At one end of the pot’s travel It’d be nice to do auto colorshifting as it pans across automatically (rainbow march like…) vs. a steady color.
Ultimately though, I would like to change the Pot controls to values on the PWM inputs from a hobby RC Rx.
+Tod Kurt said a few days ago,
"Servo pulses typically range between 1000 microseconds and 2000 microseconds, with 1500 microseconds being considered middle/neutral."
So you can do something like:
void loop() {
unsigned long duration = pulseIn(receiverPin, HIGH);
if( duration > 1700 ) { // stick pushed up
leds[0] = CRGB::Green;
}
else if( duration < 1300 ) { // stick pushed down
leds[0] = CRGB::Red;
}
else { // stick in the middle
leds[0] = CRGB::Yellow;
}
FastLED.show();
}
That code isnt what I’d use, but does give me ideas on how to get the value from the pin and begin to alter things with it.
So I would just need to convert the PWM values to something useful to alter Speed and Color.
Speed should be easy enough by division since I’ve already figured that out using a pot.
But color is going to hang me up until I start to see how to alter color as the dots pan across.
I figured there must be a way to just grab the PWM values for two or three pins and use them to alter Speed, Color and perhaps even Pattern selections for other demo’s/modes.
But for now, Speed and Color is fine and I can probably figure out how to change the pattern with a 3rd pin.
I’m fresh with coding and cludging my way thru coding, but beginning to catch on.
seems the code below needs to be copied, then pasted in proper positions and flipped. Limiting each dot their half of the positions…
I get lost after that 
I can kinda see what needs to be done and I tried a few things last night, but I got unexpected results and now come here to see if some of you can shed some wisdom on how to do this, hopefully simple project.
Here’s the meat of the Cylon code with a few comments inserted in by me-
void loop() {
// First slide the led in one direction
for(int i = 0; i < NUM_LEDS; i++) {
// When it reaches the middle it needs to stop and bounce back to the beginning.
// Set the i’th led to red
leds[i] = CRGB::Red;
// Show the leds
FastLED.show();
// now that we’ve shown the leds, reset the i’th led to black
leds[i] = CRGB::Black;
// Wait a little bit before we loop around and do it again
delay(Speed);
}
// Now go in the other direction.
// I want this to begin at the same time as the above loop.
for(int i = NUM_LEDS-1; i >= 0; i–) {
// When it reaches the middle it needs to stop and bounce back to the end.
// Set the i’th led to red
leds[i] = CRGB::Red;
// Show the leds
FastLED.show();
// now that we’ve shown the leds, reset the i’th led to black
leds[i] = CRGB::Black;
// Wait a little bit before we loop around and do it again
delay(Speed);
}
}
Thanks so much in advance for any guidance! 
~Blaine
but if you have an Android device - please review my Xmas wallpaper! (or +1) the store page if you don’t - Thanks!
Thanks again!