@ahmedk2, your topic has been moved to a more suitable location on the forum. Introductory Tutorials is for tutorials that e.g. you write, not for questions. Feel free to write a tutorial once you have solved your problem ![]()
Something to read:
- Using millis() for timing. A beginners guide
- Demonstration code for several things at the same time
- pinMode() - Arduino Reference and digitalWrite() - Arduino Reference
For time calculations, make sure that you use variables of type unsigned long.