Repeat a task 4 times then stop

The first thing you need to master is how to make non-blocking TIMERs.

i.e. avoid using delay(...)