Loop certain number of times then do action

I had changed the code and made the value a const unsigned int, but also changed the relay to a 5 post instead of using a stepdown resistor, that way I would have a distinct high or low input as you were saying. I can try and quickly draw a schematic at some point so you can get a better understanding of the system. Currently do not have a cad program with electrical schematic capabilities so it will be hand drawn.