Edit sketch 6 LEDs --> 7LEDs

Hello, I'm new and starting my adventure with Arduino. Can anyone help me edit the sketch I found here on the forum? it has 6 PWM LEDs and I need 7 PWM LEDs. Thank you in advance.

//BLOCK COMMENT
// https://forum.arduino.cc/t/knight-rider-pwm/902477
#define ProjectName "Knight rider PWM"
// CONSTANT DEFINITION
// you may need to change these constants to your hardware and needs
constexpr byte Output_[] {3, 5, 6, 9, 10, 11};
constexpr byte ledSeq[][sizeof(Output_)] {
  {255 >> 0, 255 >> 2, 255 >> 3, 255 >> 4, 255 >> 5, 255 >> 6},
  {255 >> 1, 255 >> 0, 255 >> 4, 255 >> 5, 255 >> 6, 255 >> 7},
  {255 >> 2, 255 >> 1, 255 >> 0, 255 >> 6, 255 >> 7, 255 >> 8},
  {255 >> 3, 255 >> 2, 255 >> 1, 255 >> 0, 255 >> 8, 255 >> 8},
  {255 >> 4, 255 >> 3, 255 >> 2, 255 >> 1, 255 >> 0, 255 >> 8},
  {255 >> 5, 255 >> 4, 255 >> 3, 255 >> 2, 255 >> 1, 255 >> 0},
  {255 >> 6, 255 >> 5, 255 >> 4, 255 >> 3, 255 >> 2, 255 >> 0},
  {255 >> 7, 255 >> 6, 255 >> 5, 255 >> 4, 255 >> 0, 255 >> 1},
  {255 >> 8, 255 >> 7, 255 >> 6, 255 >> 0, 255 >> 1, 255 >> 2},
  {255 >> 8, 255 >> 8, 255 >> 0, 255 >> 1, 255 >> 2, 255 >> 3},
  {255 >> 8, 255 >> 0, 255 >> 1, 255 >> 2, 255 >> 3, 255 >> 4},
  {255 >> 0, 255 >> 1, 255 >> 2, 255 >> 3, 255 >> 4, 255 >> 5},
};
// VARIABLE DECLARATION AND DEFINTION
unsigned long currentTime;
unsigned int sequence;
struct TIMER {
  unsigned long duration;
  unsigned long stamp;
};
TIMER blink_{100, 0};
// FUNCTIONS
bool checkTimer(TIMER & time_) {
  if (currentTime - time_.stamp >= time_.duration) {
    time_.stamp = currentTime;
    return true;
  } else return false;
}
void setup() {
  Serial.begin(9600);
  Serial.println(F("."));
  Serial.print(F("File   : ")), Serial.println(__FILE__);
  Serial.print(F("Date   : ")), Serial.println(__DATE__);
  Serial.print(F("Project: ")), Serial.println(ProjectName);
  for (auto Output : Output_) pinMode(Output, OUTPUT);
}
void loop () {
  currentTime = millis();
  if (checkTimer(blink_)) {
    int element = 0;
    for (auto led : Output_) analogWrite(led, ledSeq[sequence][element++]);
    sequence++;
    sequence = sequence % (sizeof(ledSeq) / sizeof(ledSeq[0]));
  }
}```

Welcome to the forum

As your topic does not relate to the installation or running of the IDE itself it has been moved to the Programming Questions category of the forum

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

In my experience the easiest way to tidy up the code and add the code tags is as follows

Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

Which Arduino board are you using ?

Arduino Leonardo

In that case you can use pin 13 as a PWM output in addition to pins 3, 5, 6, 9, 10 and 11

Where are you stuck in adding the extra pin to the sketch ?

I added and edited No. 13 in Sketch constexpr byte Output_[] {3, 5, 6, 9, 10, 11, 13};

But nothing has changed. 13-pin PWM was not created.

You need to add data to the ledSeq array to use the extra pin in the array of pins

Note that the original code has 6 entries in each row of the array, One for each original LED

What pattern of LEDs are you trying to output ?

I don't understand this code and I don't know how to edit it so that the 7 LEDs are lit.

This array seems to need a 'column' for each led, so I guess you need to add an extra column.

@PaulRB and I have both given you clues

Do you have the project working with 6 LEDs at the moment ?

I think so too, but I don't know how because I don't know sketch writing that well. That's why I wrote here if anyone could tell me what to change to make it work properly.

Yes, 6 diodes worked.

Hello adriansrut

This sketch was designed in Sep 2021 to run with PWM outputs only.
You might extend this sketch to run on a Arduino Mega.

If you don't know, try to learn it.
What is the problem to add an extra column to the array?

Arduino Leonardo will not work with 7 PWM outputs?

Read and study the data sheet

The problem is that I don't really understand how to read these columns.

Read any C++ language textbook about arrays.

What 6 LED pattern does it produce at the moment and what 7 LED pattern do you want it to produce ?

Can you match the pattern that it produces now with the data in the array ? Concentrate on one LED and maybe slow down the output to help see what is going on

What happens if you leave it at 6 LEDs and change the values in one row of the array ? Can you see how your changes affect the LED ?

What is general purpose to add a 7th LED to the project?

I don't know. I have 12 lines, so 2 lines are assigned to one LED. and I can't add another 2 lines to make the diagram work with 7 LEDs.

for my LED strip, specifically 12volt bulbs, I need 7 LEDs. I have 7 places.