 
   //states[0] = LED_STATE_ON;
 
+  analogWrite(P_LED_LATCH, LOW);
   shiftOut();
+  analogWrite(P_LED_LATCH, HIGH);
 
 }
 



void shiftOut() {

  analogWrite(P_LED_LATCH, LOW);

  shiftOut(P_LED_DATA, P_LED_CLOCK, LSBFIRST, val);
  
  /*analogWrite(P_LED_CLOCK, LOW);

  //Loop for every byte
  for (uint8_t i = 0; i < 8; i++)  {
    Serial.println("Index : " + String(i) + ". State : OFF " + String(!!(val & (1 << i))));
    digitalWrite(P_LED_DATA, !!(val & (1 << i)));
    //Write byte
    
    switch (states[i]) {
      case LED_STATE_OFF:
        Serial.println("Index : " + String(i) + ". State : OFF " + String(states[i]));

        analogWrite(P_LED_DATA, LED_TWO_VOLTS);
        break;
    }


    //Clock
    analogWrite(P_LED_CLOCK, HIGH);
    analogWrite(P_LED_CLOCK, LOW);
    }
  */


  Serial.println("Done");
}

