Arduino ignoring function void loop

#include <LiquidCrystal.h>
#include <Keypad.h>
#include <Adafruit_NeoPixel.h>

#define QUANTIDADE_LINHAS	4	// Número de linhas disponíveis no teclao
#define QUANTIDADE_COLUNAS	4	// Número de colunas disponíveis no teclado
#define NUM_LED 8 // Número de Leds disponíveis
#define PIN 8 // Pino onde o Led se encontra

// Mapa identificando a disposição dos caracteres no teclado
char mapaTeclado[QUANTIDADE_LINHAS][QUANTIDADE_COLUNAS]= {
  {'1', '2', '3', 127},
  {'4', '5', '6', 125},
  {'7', '8', '9', 126},
  {'*', '0', '#', 63}
};

// Definição dos pinos das linhas e colunas
byte pinosLinhas[QUANTIDADE_LINHAS] = {A1,A2,A3,A4};      // Linhas de cima p/ baixo
byte pinosColunas[QUANTIDADE_COLUNAS]= {9,10,11,12}; // Colunas da esquerda p/ direita

// Inicializa a biblioteca do teclado, informando o mapa, pinos do Arduino que serão usados e tamanho do teclado
Keypad teclado = Keypad(makeKeymap(mapaTeclado), pinosLinhas, pinosColunas, QUANTIDADE_LINHAS, QUANTIDADE_COLUNAS);
// Inicializa a biblioteca do LCD
LiquidCrystal lcd(2,3,4,5,6,7);
// Inicializa a biblioteca do NeoPixel
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUM_LED,PIN,NEO_GRB+NEO_KHZ800);

void setup() 
{
  teclado.begin(makeKeymap(mapaTeclado));
  pixels.begin();
}

void loop() 
{ 
  randomSeed(1);
	int i=0, j=0, k=0;
  	int l=0, p=0, c=0; 
    int g[5]={0,0,0,0,0}, x[4]={254,0,0,254}, y[4]={0,250,0,250}, z[4]={0,0,252,0},f[8];
	char resp[8][9][10][11], ordem[8][9][10], resul[8][9][10][11];
	for(i=0;i<8;i++)
    {
		for(j=1;j<9;j++)
		{
			for(k=2;k<10;k++)
			{
				for(l=3;l<11;l++)
				{
					resul[i][j][k][l]=0;
				}
			}
		}
	}
	for(i=0;i<8;i++)
	{
		ordem[i][0][0]=random(4);
		f[i]=random(3)+1;
	    for(j=0;j<8;j+=f[i])
		{
	  		pixels.setPixelColor(j, pixels.Color(x[ordem[i][0][0]], y[ordem[i][0][0]], z[ordem[i][0][0]]));
		}
		switch(f[i])
		{
			case 2:
			ordem[0][i+1][0]=random(4);
			for(j=1;j<8;j+=f[i])
			{
	  			pixels.setPixelColor(j, pixels.Color(x[ordem[0][i+1][0]], y[ordem[0][i+1][0]], z[ordem[0][i+1][0]]));
			}
			break;
			case 3:
			ordem[0][0][i+2]=random(4);
			ordem[0][i+1][0]=random(4);
			for(j=1;j<8;j+=f[i])
			{
	  			pixels.setPixelColor(j, pixels.Color(x[ordem[0][i+1][0]], y[ordem[0][i+1][0]], z[ordem[0][i+1][0]]));
			}
			for(j=2;j<8;j+=f[i])
			{
	  			pixels.setPixelColor(j, pixels.Color(x[ordem[0][0][i+2]], y[ordem[0][0][i+2]], z[ordem[0][0][i+2]]));
			}
			break;
		}
	    pixels.show();
		lcd.setCursor(0,0);
		lcd.print("Numero de Cores");
		do
  		{
  			resp[i][0][0][0]=teclado.waitForKey();
  		}while(resp[i][0][0][0]<=30||resp[i][0][0][0]>33);
  		lcd.setCursor(1,0);
		lcd.print(resp[i][0][0][0]);
  		delay(300);
  		lcd.clear();
  		lcd.setCursor(0,0);
  		lcd.print("1.COR");
  		do
  		{
  			resp[0][i+1][0][0]=teclado.waitForKey();
  		}while((resp[0][i+1][0][0]*2)!=254&&(resp[0][i+1][0][0]*2)!=250&&(resp[0][i+1][0][0]*2)!=252&&(resp[0][i+1][0][0]*8)!=504);
		lcd.setCursor(0,1);
		lcd.print(resp[0][i+1][0][0]);
  		switch(resp[i][0][0][0])
  		{
  			case 2:
  				delay(300);
		  		lcd.clear();
		  		lcd.setCursor(0,0);
				lcd.print("2.COR");
		  		do
		  		{
		  			resp[0][0][i+2][0]=teclado.waitForKey();
		  		}while((resp[0][0][i+2][0]*2)!=254&&(resp[0][0][i+2][0]*2)!=250&&(resp[0][0][i+2][0]*2)!=252&&(resp[0][0][i+2][0]*8)!=504);
				lcd.setCursor(0,1);
				lcd.print(resp[0][0][i+2][0]);
	  		break;
		  	case 3:
		  		delay(300);
		  		lcd.clear();
		  		lcd.setCursor(0,0);
				lcd.print(resp[i][0][0][0]);
		  		lcd.print("2.COR");
		  		do
		  		{
		  			resp[0][0][i+2][0]=teclado.waitForKey();
		  		}while((resp[0][0][i+2][0]*2)!=254&&(resp[0][0][i+2][0]*2)!=250&&(resp[0][0][i+2][0]*2)!=252&&(resp[0][0][i+2][0]*8)!=504);
				lcd.setCursor(0,1);
				lcd.print(resp[0][0][i+2][0]);
		  		delay(300);
		  		lcd.clear();
		  		lcd.setCursor(0,0);
				lcd.print(resp[i][0][0][0]);
		  		lcd.print("3.COR");
		  		do
		  		{
		  			resp[0][0][0][i+3]=teclado.waitForKey();
		  		}while((resp[0][0][0][i+3]*2)!=254&&(resp[0][0][0][i+3]*2)!=250&&(resp[0][0][0][i+3]*2)!=252&&(resp[0][0][0][i+3]*8)!=504);
				lcd.setCursor(0,1);
				lcd.print(resp[0][0][0][i]);
		  		delay(300);
				lcd.clear();
	  		break;
		  	default:
		  	break;  		
		}
	}
	for(i=0;i<8;i++)
	{
		if(f[i]!=resp[i][0][0][0])
		{
			resul[i][0][0][0]=resp[i][0][0][0]*(-1);
			resul[0][i+1][0][0]=ordem[i][0][0];
			resul[0][0][i+2][0]=ordem[0][i+1][0];
			resul[0][0][0][i+3]=ordem[0][0][i+2];
			break;
		}
		else
		{
			for(j=1;j<9;j++)
			{
				if(resp[0][j][0][0]!=ordem[j][0][0])
				{
					resul[0][j][0][0]=ordem[j][0][0];
				}
				if(f[i]>1)
				{
					for(k=2;k<10;k++)
					{
						if(resp[0][0][k][0]!=ordem[0][k][0])
						{
							resul[0][0][k][0]=ordem[0][k][0];
						}
						if(f[i]>2)
						{
							for(l=3;l<11;l++)
							{
								if(resp[0][0][0][l]!=ordem[0][0][l])
								{
									resul[0][0][0][l]=ordem[0][0][l];
								}
							}
						}
					}
				}
			}
		}
	}
	for(i=0;i<8;i++)
	{
		if(resul[i][0][0][0]<0)
		{
			lcd.setCursor(0,0);
			lcd.print("ACROMATICO");
			break;
		}
		else
		{
			for(j=1;j<9;j++)
			{
				for(k=2;k<10;k++)
				{
					for(l=3;l<11;l++)
					{
						for(c=0;c<=g[0];c++)
						if(resul[0][j][k][l]!=0&&resul[0][j][k][l]!=g[c+1])
						{
							g[0]++;
							g[g[0]]=resul[0][j][k][l];
							break;
						}
					}
				}
			}
		}
	}
	switch(g[0])
	{
		case 0:
		lcd.setCursor(0,0);
		lcd.print("S/ daltonismo");
		break;
		case 1:
		lcd.setCursor(0,0);
		lcd.print("nao enxerga");
		switch(g[1])
		{
			case 1:
			lcd.setCursor(0,1);
			lcd.print("vermelho");
			break;
			case 2:
			lcd.setCursor(0,1);
			lcd.print("verde");
			break;
			case 3:
			lcd.setCursor(0,1);
			lcd.print("azul");
			break;
			case 4:
			lcd.setCursor(0,1);
			lcd.print("amarelo");
			break;
		}
		break;
		case 2:
		lcd.setCursor(0,0);
		lcd.print("nao enxerga");
		switch(g[1])
		{
			case 1:
			lcd.setCursor(0,1);
			lcd.print("vermelho");
			break;
			case 2:
			lcd.setCursor(0,1);
			lcd.print("verde");
			break;
			case 3:
			lcd.setCursor(0,1);
			lcd.print("azul");
			break;
			case 4:
			lcd.setCursor(0,1);
			lcd.print("amarelo");
			break;
		}
		delay(300);
		lcd.clear();
		lcd.setCursor(0,0);
		lcd.print("nao enxerga");
		switch(g[2])
		{
			case 1:
			lcd.setCursor(0,1);
			lcd.print("vermelho");
			break;
			case 2:
			lcd.setCursor(0,1);
			lcd.print("verde");
			break;
			case 3:
			lcd.setCursor(0,1);
			lcd.print("azul");
			break;
			case 4:
			lcd.setCursor(0,1);
			lcd.print("amarelo");
			break;
		}
		break;
		case 3:
		lcd.setCursor(0,0);
		lcd.print("nao enxerga");
		switch(g[1])
		{
			case 1:
			lcd.setCursor(0,1);
			lcd.print("vermelho");
			break;
			case 2:
			lcd.setCursor(0,1);
			lcd.print("verde");
			break;
			case 3:
			lcd.setCursor(0,1);
			lcd.print("azul");
			break;
			case 4:
			lcd.setCursor(0,1);
			lcd.print("amarelo");
			break;
		}
		delay(300);
		lcd.clear();
		lcd.setCursor(0,0);
		lcd.print("nao enxerga");
		switch(g[2])
		{
			case 1:
			lcd.setCursor(0,1);
			lcd.print("vermelho");
			break;
			case 2:
			lcd.setCursor(0,1);
			lcd.print("verde");
			break;
			case 3:
			lcd.setCursor(0,1);
			lcd.print("azul");
			break;
			case 4:
			lcd.setCursor(0,1);
			lcd.print("amarelo");
			break;
		}
		delay(300);
		lcd.clear();
		lcd.setCursor(0,0);
		lcd.print("nao enxerga");
		switch(g[3])
		{
			case 1:
			lcd.setCursor(0,1);
			lcd.print("vermelho");
			break;
			case 2:
			lcd.setCursor(0,1);
			lcd.print("verde");
			break;
			case 3:
			lcd.setCursor(0,1);
			lcd.print("azul");
			break;
			case 4:
			lcd.setCursor(0,1);
			lcd.print("amarelo");
			break;
		}
		break;
	}
	teclado.waitForKey();
}

I tried simulating this code in tinkercad but it just jumps the void function. I tried searching and printing something in serial and it just prints " ÿ" repeatedly

Welcome to the forum and thank you for using code tags in your first post

What exactly do you think is being ignored ?
Your thread title is messed up but you can change it

the entire loop function. using the debbuger i could see where it´s stopped, in this case on "randomSeed(1)"

Whatever is going on

randomSeed(1)

is a waste of time as if it worked it would always cause the "random" number generator used by the random() function to return the same sequence of numbers so you might just as well not use it

Which debugger are you referring to ?

Which arduino? The char arrays in loop need a huge amount of memory.

the one on tinkercad, i dont know the specific name

Arduino Uno R3.

I fogort i could just send the link

This needs more than 16kBytes of RAM. Much too much for an Arduino UNO which has only 2kBytes

I'll try to find a substitute for these array. Any tips?

Hello
I can think about it, if you describe in simple words the task of your sketch and this very simple.
Have a nice day and enjpy coding in C++.

I too woukd benefit from a description of what you are trying to accomplish.

Mostly to see how you managed to need four dimensional arrays.

a7

i'm making a school project to test daltonism. the idea was to light up to 3 different colours and ask how much colours the pacient saw and wich ones between red, green, blue and yellow. I tried to use the four dimensional array to make a precise diagnostic if he could differentiate them and what colour he can't see.

but for now i errased one array and turned the four to three dimensional and gonna use only 2 colors at the same time. this way i could simulate

OK there probably is a way to need 4D arrays.

But there is certainly a way to do your projext without.

Please describe what you are trying to accomplish. I know you may think you have responded, still kinda in the dark here dets-wise.

In detail: What is a test? How is it performs? What are the data that result from a test? How many tests does a full examination consist in?

And so forth.

a7

the test show specific colours that people with daltonism can´t see and, based on their answers, it will diagnosticate the typo of daltonism. the responses would be separated between each dimension of the array, the number of colours being stored in the fourth dimension and what colours appeared through the first to third dimension. in the moment there´s eight cycles with different patterns for each interation. after, the answers will be analised and separated.

You have a few instances of addressing past the end of an array - set the compiler preferences to show all warnings so you can see where these are.

Have not looked at the code enough to understand the logic, but I do notice that you are currently only using a small portion of the arrays - you will have one of the array indexes as a variable, but the others are all set to zero. Of the three largest arrays, only resul is varying more than one index at a time (with all others set to zero), and that particular case has the first index set to zero.

For a reliable diagnostic test, I would not think you would want to be using random color patterns (although with the randomseed you are generating identical patterns every time the code runs). May be better to have a fixed set of patterns, and display them in a random order without repeats, or with a specific number of repeats for each pattern.

I can’t help but thinking you really don’t understand what a four dimensional array even is.

You still have not said anything that explains why you need them; if you are exploiting them it seems like you had to go out of your way to do.

a7

Often coders implement multiple arrays or multi-dimensional arrays when they can’t see a calculated algorithmic approach.

Certainly lookup tables are usually faster to execute, but in cases like this a day spent thinking about the maths is well worth it.