I need help for animating custom led array

Hi. I created a custom RGB led array. I am simulating common anode RGB leds like on the attachment image. Because Tinkercad doesn't have common anode RGB leds. I am opening and closing leds with octocouplers fastly and changing PWM pins for led colors. I tried it in real life and it works. I can define colors for the leds one by one and leds working in correct color. I need help for integrating this system to FastLED project. If it is too hard, how can I animate this leds. Thanks for help and Sorry for my bad English. The code and image are on the attachment.

My code:

int leds[4] = {13,12,11,10};
int red = 6;
int green = 5;
int blue = 3;
int _delay = 5;

void setup()
{
  pinMode(leds[0], OUTPUT);
  pinMode(leds[1], OUTPUT);
  pinMode(leds[2], OUTPUT);
  pinMode(leds[3], OUTPUT);
  pinMode(red, OUTPUT);
  pinMode(green, OUTPUT);
  pinMode(blue, OUTPUT);
}

void loop()
{
  delay(_delay);
  CloseLed();
  SetColor(255,0,0);
  OpenLed(0);
  delay(_delay);
  CloseLed();
  SetColor(0,255,0);
  OpenLed(1);
  delay(_delay);
  CloseLed();
  SetColor(0,0,255);
  OpenLed(2);
  delay(_delay);
  CloseLed();
  SetColor(0,255,120);
  OpenLed(3);
}

void OpenLed(int led){
  for(int i=0;i<4;i++){
    if(led==i){
      digitalWrite(leds[i], HIGH);
    }else{
      digitalWrite(leds[i], LOW);
    }
  }
}

void CloseLed(){
  for(int i=0;i<4;i++){
    digitalWrite(leds[i], LOW);
  }
}

void SetColor(int r, int g, int b){
    analogWrite(red, r);
    analogWrite(green, g);
    analogWrite(blue, b);
}

|500x308

design.jpg|1359x838

honor54: I tried it in real life and it works.

That is quite impressive, considering the gross limitations of the optocouplers! The only reason to use optocouplers here would be that you are using LEDs which require more than 5 V.

Check out the instructions regarding how to post your code so that it can be examined.

You do realise that "Fastled" uses totally different, "addressable" LED strips do you not? :astonished:

Paul__B: That is quite impressive, considering the gross limitations of the optocouplers! The only reason to use optocouplers here would be that you are using LEDs which require more than 5 V.

Check out the instructions regarding how to post your code so that it can be examined.

You do realise that "Fastled" uses totally different, "addressable" LED strips do you not? :astonished:

Thanks for your reply. Yes, my leds need 12v. I know Fastled uses adressable leds. I want to run Fastled normally but If I can simulate adressable leds like virtual leds and If I can get leds's current colors, I can use this colors for my leds. Or I can make my own animations for my system but before that, I am trying to find any other solutions.

Well, let's just say that Fastled and your lash-up there - which is severely limited in functionality - are a world apart. There is simply no point imagining you can simulate one with the other.