Ok, I’m getting crazy. Seriously I don’t know whats wrong with my code. I’ve reduced it to the absolute minimum and it still doesn’t work.
Basically it runs through until it reaches the “Serial.println(“Back”);” and then it resets my Arduino Nano.
Any ideas?
(Please ignore that this example in principle doesn’t make a lot of sense. But I don’t want to paste the whole code. Simply too much and the error is the same)
Btw. FastLED version is 3.001.006
#include <FastLED.h>
FASTLED_USING_NAMESPACE
#define DATA_PIN 5
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB
#define NUM_LEDS 12
CRGB leds[NUM_LEDS];
#define BRIGHTNESS 100
byte i = 0;
boolean moveDirection = false;
void setup()
{
Serial.begin(9600);
FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);
Serial.println(“initialized FastLED”);
FastLED.setBrightness(BRIGHTNESS);
}
void loop()
{
if (i == NUM_LEDS)
{
moveDirection = false;
Serial.println(“Back”);
}
if (i == 0)
{
moveDirection = true;
Serial.println(“Forward”);
}
leds[i] = CRGB(255, 120, 20);
if (moveDirection)
{
i++;
}
if (!moveDirection)
{
i--;
}
Serial.println(i);
FastLED.show();
delay(200);
}
Leds[NUM_LEDS] is outside of the array - so you are overwriting random memory and that generally doesn’t end well for anyone. You should subtract 1 from i after you set moveDirection to false.
Somewhat off topic, but I’d use one of the FastLED wave functions, possibly even beatsin8() in order to move an LED back and forth. So much less logic and hand wringing involved. Oh, and using delays? Those can be deadly down the road.
Oh, and:
No fancy logic or delays with this. Furthermore, you get a nice little trailer with it as well.
@Daniel_Garcia
Of course you are right. The same stupid mistake follows me in every project 
@Andrew_Tuline
Of course I don’t use delays in my projects. This was just a test without external influence. So I used a Damon save solution.
Usually I use my own library which works with Millis and is rollover save.
In general I write code always non blocking.
I thought about beatsin as well. But in the real code it doesn’t work. An the slowdown at beginning and end is also a problem.
@Sven_Eric_Nielsen Aah. Instead of beatsin8(), you could probably use trivwave() combined with millis(), but it sounds like you’re already well into the game, and if you use your own library, all bets are off. 
@Andrew_Tuline
Triwave could indeed be an option. Never thought about it. Need to check the fastled documentation again. Thanks!
It’s quite difficult to remember all options provided by this big amazing library. Therefore I love community’s like this one 