ok, now it’s time to post the three chunks you have, and we can suggest how to stitch it together.
Code tags </> will make everyone happy to help you.
Remember millis() if you want the code to be responsive and flexible, no delay() if you can help it !