Arduino program occasionally stops running.

Digital 0 and 1 are also used for serial connections.

A description of the sketch means nothing to anyone I am afraid.
Include you sketch on your next post but ensure you use code tags to do so ( </> )

EDIT..

Your edit above is much better it makes it easier for people to help you.