I want to create a pattern but have no real understanding on how todo

I want to create a pattern but have no real understanding on how todo so. I was curious if anyone had some links/doc/info to help me along.

I understand the basics and can modify the hell out of someone else code but thats getting old. Something just is not “clicking” for me and I’m sure it’s my lack of higher math skills. Which I have almost completely forgotten.

Thanks in advance for any and all help :slight_smile:

Start somewhere. Even if it’s as simple as turning one LED on and off. Then do two LEDs, then three, then ten. Start adding other tricks like fades, strobes, color cycling, etc., etc. Eventually you’ll find yourself writing more and more complex pieces.

go old school and draw and color your ideas on some grid paper. i find it helps me sort out the math sometimes when i get lost in the code.

Also, it really really helps some people to think of this as traditional old-school ‘cel’ animation. You draw one frame of the animation, and then take a picture (or in our case, call FastLED.show()). The clear the cel (the leds array). Then you draw the next frame, and call show(), and clear the array. Then draw the next frame, and call show(), and clear the array.

Design out on paper what you want the first frame to look like. Then design what you want the next frame to look like, then the 3rd, the 4th, etc.

Suppose “~” means dark blue and “X” means red, and you design your frames like this:

  1. X ~ ~ ~ ~
  2. ~ X ~ ~ ~
  3. ~ ~ X ~ ~
  4. ~ ~ ~ X ~
    5.~ ~ ~ ~ X
  5. X ~ ~ ~ ~
  6. ~ X ~ ~ ~
  7. ~ ~ X ~ ~
  8. ~ ~ ~ X ~
    10~ ~ ~ ~ X

Then write code to ‘draw’ one frame into the leds buffer.

void DrawOneFrame( int frameNumber )
{
for( int i = 0; i < NUM_LEDS; i++) {
leds[i] = CRGB::DarkBlue;
}

int X = frameNumber % NUM_LEDS;
leds[ X ] = CRGB::Red;
}

Your loop function then pretty much always looks like this:

void loop()
{
static int frameNumber = 0;
frameNumber++;
DrawOneFrame( frameNumber);
FastLED.show();
FastLED.delay( 20); // or whatever delay speed you like
}

There are a thousand other ideas and ways to do this; I’m just showing this one as a general approach: focus on what you want ONE frame of the animation to look like. Just one. Then write the code to draw that one frame, and take it from there.

I really like the paper idea! @Mark_Kriegsman thanks for posting the code. I blieve this will help out!!

Sounds like I’m in the same boat as you @Larry1 !
I have resorted to @Ashley_M_Kirchner_No 's suggestion of starting at the very beginning and comming up with my own interpretation of the blink and cyclon examples and adding things from there.

I really appreciate this thread. It helps me see what others are doing to solve the same problems I run into.

My handwriting is terrible so I do most of my drawings using software - like DraftSight.

Finding patterns has also driven me to brush up on my geometry, algebra, trig and even some calc.

And something that I have just started looking at is: the golden ratio to determine how the spacing of leds in a square pattern might not give the best look. http://en.wikipedia.org/wiki/Golden_ratio