I have a LED strip(WS2812B) of 144 LED's. My Projet is to light up a line of 10 dots at the beginning of the strip, and send it down to the end of the strip - but as the first dot disappears at the end position, I want another dot to already appear at the beginning of the strip. And following this logic, when 2 dots disappear at the end of the strip, I want two new ones to appear at the beginning of the strip, so that at any given time I have 10 dots lit simultaneously ( for example 7 dots at the end of the strip - 3 dots at the beginning, 6 dots at the end - 4 at the beginning, etc.). Usually in all of the codes that I used so far, all 10 dots first have to disappear at the end position and only then does the new line appear dot by dot at the beginning of the strip. I want to create a loop so that as the dots disappear one by one at the end position, they simultaneously appear one by one at the beginning of the strip. Any ideas?
First write a function that sets all your LEDs to black, call it wipe. Then have a variable start at zero and have a loop that goes round ten times. Each time round the loop you first call wipe and then add the loop variable to your start variable to get the led you want to light, if this number is over 144 then subtract 144 from it otherwise leave it alone and call the set colour function for this led number. Then display, then increment your start variable number until it reaches 144 and then reset it to zero. Put this in an infinite loop for your display.