Hello,
Start working with a simple timer first and understand that. Then work on integrating into your code.
:)