Loop certain number of times then do action

for me it just looks like there is missing a 10kOhms pulldown resister from pin 2 to ground