All im trying to do is move an led across and back on a

All im trying to do is move an led across and back on a strip of leds. this has been done many time before. however now that im integrating a solution into FastLed and trying to add a button to start and stop, things went haywire.

Cant figure out whats causing my variable to change unexpectedly. Ive tried changing a lot of things, so many it would be hard to list. Maybe someone can look this over and explain what ive done wrong here.

Ive added my serial monitor debugging output to the bottom as well

Thanks
https://pastebin.com/xd9zJxrp

I think line 45 needs to be NUM_LEDS-2, otherwise you can write to a pixel past the end of your strip. Writing to pixels that don’t exist can cause bad things. Check for that issue in the rest of your code also.

Yup. That was it!
I changed line 45 and line 62…

if (pos < NUM_LEDS-1) {

Great to know!
I had a lot more simplified code but had to dumb it down to get an idea of why my program was crashing.

Thanks Marc