int counter = 1;
int direction = 1;
unsigned long changeTime = 0;    //unsigned int so POZITIVNA CELA ŠTEVILA
int timeDelay = 200;
byte value = 0;

// 4. NAČIN
int ledPin[] = {1,2,4,8,16,32,64,128,0,255,0,255, 0x0F, 0, 0xF0, 0};
int ledPin1[] = {255,0,255,0};

void setup() {
  DDRD = 0xFF;   //255 ali 0b11111111
  DDRB &= 0b11111110;
  changeTime = millis();
}

void loop() {
  // 1. NAČIN
  /*
  for(int x = 0; x < 8; x++) {   //najprej določiš od koliko naprej štarta for (1,2,3..); kolikokrat se izvede; za kokiko se poveča (x++  +1,+2...)
    PORTD = counter;
    delay(200);
    counter *= 2;   //counter = counter * 2
    //Serial.println(counter);
    if(counter > 128) counter /= 2;
  }

  for (int x = 0; x < 8; x++) {
    PORTD = counter;
    delay(200);
    counter = counter / 2;
    if(counter < 1) counter = 1;
  }*/
  

  // 2. NAČIN
  /*
  PORTD = counter;
  if((millis() - changeTime) > timeDelay) {
    if(direction == 1) {
      counter *= 2;
    }
    else counter /= 2;
    changeTime = millis();
    if(counter > 64) direction = 0;
    if(counter <= 1) direction = 1;
  }
  */

  // 3. NAČIN - gumb spremeni smer
  /*
  value = PINB & 0b00000001;   //0x01

  if((millis() - changeTime) > timeDelay) {
    if(value == 0) {   //tipka pritisnjena
      if(counter > 120 || counter < 1) counter = 1;
        PORTD = counter;
        counter *= 2;
    }

    if(value == 1) {   //tipka ni pritisnjena
      if(counter <= 0 || counter > 128) counter = 128;
        PORTD = counter;
        counter /= 2;
    }
    changeTime = millis();
  }
  */

  // 4. NAČIN - vmes 2 vse utripnejo
  //beri tipko
  /*if( ) {
    for(int x = 0; x < (sizeof(ledPin) / sizeof(ledPin[0])); x++) {
      PORTD = ledPin[x];
      delay(300);
    }
  }
  else if( ) {   // tipka ni pritisnjena
    for(int x = 0, x < (sizeof(ledPin) / sizeof(ledPin[0])); x++) {
      PORTD = ledPin1[x];
      delay(300);
    }
  }*/
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
led1:A
led1:C
led2:A
led2:C
led3:A
led3:C
led4:A
led4:C
led5:A
led5:C
led6:A
led6:C
led7:A
led7:C
led8:A
led8:C
r1:1
r1:2
r3:1
r3:2
r4:1
r4:2
r5:1
r5:2
r6:1
r6:2
r7:1
r7:2
r8:1
r8:2
r9:1
r9:2
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r
r2:1
r2:2