void setup() {
  DDRB = 0x0f;
}

void loop() {
static int bits = 0;
static unsigned long lastUpdateTime = 0;

  unsigned long _now = millis();
  if (_now - lastUpdateTime >= 500) {
    lastUpdateTime = _now;
    PORTB = bits;
    bits = (bits + 1) % 16;
  }
}
$abcdeabcde151015202530fghijfghij