pinbal machine

Post your code in code tags. Many forum readers use smartphones and tablets and can't open .ino attachments. If the code is too large to post in code tags (you get an error when you press post) then make a cut-down version of your sketch containing just enough to demonstrate the problem. (Quite often, while making the cut-down version, you figure out what the problem was yourself.)

A schematic would also be very helpful. If using Fritzing, use the schematic view, not the breadboard view.