iterate over bits on one pin?

mixographer:
The only thing I changed was the pin (13, it has an LED on my Uno.) and the delay, since I wanted to see the LED change. Did I do something wrong? Or is the example code missing some detail?

Something like this may be what you need:

#define LED_PIN 13
uint8_t pattern;

pattern = 0b01010101; // off/on/off/on/etc....
bits_out (pattern); // send it
delay (1000); // wait between demos

pattern = 0b11110000; // long on, long off
bits_out (pattern);
delay (1000); // wait between demos

void bits_out (uint8_t data)
{
    uint8_t bits = 8;
    while (bits--) {
        digitalWrite (LED_PIN, data & _BV (bits) ? HIGH : LOW); // LED on or off depending on bit
        delay (250); // delay between bits so you can see the blinks
    }
}

For longer runs of bits, you can change the "uint8_t data" to uint16_t, uint32_t or even uint64_t (and change "bits" to 16, 32 or 64 as necessary).

Hope this helps.