# Multi-array number generation

This part of my project is very hard for my brain to wrap around and comprehend. But basically I just need to go through every combination. For example:

If I have an array with 255 variables and I need to bruteforce all the combinations by 30's (0, 30, 60, 90) How would I go about doing that in a decently compact form? It's really brain hurting please help a noob out <3

Note: I'm making a universal IR Remote but if by chance I don't have the code then I can just change the mode to brute force it.

``````volatile uint16_t IRCode[]={384,171,43,21,21,21,21,21,21,64,21,21,21,21,21,21,21,21,21,64,21,21,21,64,21,21,21,64,21,64,21,64,21,64,21,64,21,21,21,21,21,21,21,64,21,21,21,21,21,21,21,21,21,64,21,64,21,64,21,21,21,64,21,64,21,64}; // ProntoHex to uint16_t delete first 4 array numbers.
volatile uint16_t MicrosPassed;
volatile uint8_t ArraySeq;
uint8_t LEDState;
uint8_t SetMode=0;

void setup() {
Config();
SendIRCode();
}

void loop() {

}

void SendIRCode() {
if(LEDState==1) {
TCCR1A&=63;
LEDState=0;
} else {
TCCR1A|=192;
LEDState=1;
}
}

void Config() {
DDRB|=10;
ICR1=416;
OCR1A=9983;
TCCR1A=2;
TCCR1B=24;
TCCR1B|=1;
TIMSK1=1;
}

ISR(TIMER1_OVF_vect) {
MicrosPassed++;
if(MicrosPassed==IRCode[ArraySeq]) {
SendIRCode();
MicrosPassed=0;
ArraySeq++;
}
}
``````
• this is a general programming question that is not arduino specific Nov 7, 2020 at 21:54
• examine the use of `for` loops Nov 7, 2020 at 21:55
• @fman122: your Config function is plain AVR C code. The only Arduino flavor is the fact that you have a setup and loop function rather than a main (or some other entry point) - and you're not using any Arduino functions in there either.
– Mat
Nov 7, 2020 at 22:23
• What do you mean by "all the combinations by 30's"? Do you mean any possible combination of 30 elements out of the 255? Nov 7, 2020 at 23:32
• Not sure why you doing this? there are library exist that you could use, or learn from. You may want to take a look at Arduino-IRremote which was based on a c-library long existed even before Arduino was invented. Take a look at the IRsendRawDemo example, and the library source code. Nov 8, 2020 at 9:07