Arduino randomly resetting itself during operation