Hi, I am still working on a cylon project and have got quite stuck!

Hi, I am still working on a cylon project and have got quite stuck! I’m using ws2812’s x 30 with an arduino uno and want to create a cylon with 3 potentiometers to control brightness, colour and speed- so far so good, thanks to Stuart Taylor!
Next I wanted to add a pushbutton. Eventually I want the push button to cue the cylon into a" slowing down to a stop" sequence, but to begin with stop/start would be good!
I added code for a pushbutton in the beginning of the loop, which worked in as much as it read the button signal if it happened to be pressed at the beginning of the loop.
I’ve been advised that if I want the button signal to be read throughout the loop then I will need to re-write the code without using delay (using millis instead). I’ve had a go at this, as has a fellow arduinist and both attempts threw up a wierd flickering display, not a cylon.
My impression is that I need to de-construct my sketch, start with a “cylon without delay” and re-build the code from there.
What I want to ask is; is there a “cylon without delay” in existence anywhere? Or can anyone help me to write it as I’m feeling very out of my depth with the whole thing at the mo :frowning:
Thanks in advance for your advice and suggestions :slight_smile:

You might want to look at the demos provided in FastLED 3.1’s demoreel100.ino and adapt from there. It’s a much cooler way of ‘moving’ LED’s around. Oh, and I’ve de-constructed; thrown out and completely deleted many sketches I once held dear to my heart.

I often start by making several small programs, each focusing on just one aspect of the bigger goal. Also version up often as you get things working. This makes it much easier to feel comfortable reworking and changing a bunch of stuff. You can always load that previous version back up if you get yourself stuck.

Try modding this example to have it turn on/off running a cylon effect to learn about avoiding using delay.
http://arduino.cc/en/Tutorial/BlinkWithoutDelay
Note: pay attention to where long variables are used. Not using a long where needed can mess things up.

Make another small sketch to learn about reading a button push.
http://arduino.cc/en/Tutorial/Debounce

After understanding the pieces you can start assembling the larger puzzle. :slight_smile:

@Andrew_Tuline Thanks for mentioning the demoreel100.ino. First I’ve heard of it, but a GREAT resource for a newbie like me!

Thanks for the encouragement and support :slight_smile: Looking forward to a day off so I can nerd away…
Have just downloaded fastled 3.1 and excited to get things going but getting all kinds of compile errors. Any ideas what I’ve done wrong? (I have Arduino IDE 1.0.6).

Isn’t FastLED 3.1 one of the branches still in progress? Maybe delete that one and try the current master.zip release (which I believe is 3.0.something, but not yet 3.1)
https://github.com/FastLED/FastLED/archive/master.zip