Binary Counting?

You could put your ten pin numbers in an array, then use bitRead in a for loop on your counter variable to set/reset the pins.