I've used millis() as a delay replacement in multiple projects with no problem. My issue has to do with a requirement for a delay inside a for loop. If I continue because enough millis haven't occurred, the for loop continues to count (up in my case). I don't want that. I want the for loop to wait until the time has elapsed. If I use 'while the time is not up' the for loop waits (as I want) but nothing else gets executed in the program either. To me, this is no improvement over using a delay instruction. Is there another way?
If anyone is interested, the project is to replace bubble tubes on a tabletop juke box with led strips. I want the led "bubbles" to appear random so I created several bit masks that are selected at random. At the beginning of a for loop, the first position in the mask is checked (1=bubble, 0=no bubble) to control the first led. If the mask indicates no bubble I just continue (leds are already on) but to show a bubble I must turn the led off but only for a few milliseconds. I then shift the mask and with an inner loop, move all the previous bubbles one led up the strip then repeat.
Everything is working fine but I'm using delays and want to add more functions that should be executed independently of the bubbles but I'm stuck. Any suggestions?
Thank you. I really appreciate you folks being here.