Need help with delay function

you're welcome..

can add some serial prints to see what's going on inside..
aides in debugging things..

project in a simulator..

good luck.. ~q