Help with array!

All I want to happen is for the array to increase whenever the beam is tripped. Sounds so simple :[

Currently whenever the beam is tripped a series of 0s are read from the digitalInput and while it is active a series of 1s.

There must be an easy solution.