Using Serial.print() produces a reset after switching from Micro to Nano every

So at work I am building a Poster with lots of Neopixels to draw attention to our work. The code has gotten so big, that I ran out of RAM on the Micro I was using. Apperently Neopixels need a lot of free RAM to send the data out to the LEDs. Arduino IDE showed 70 % RAM used, no errors, but the LEDs just didnt light up. Took me a long time to figure this one out.

So I switched to the Arduino with the most RAM and a 5 V architecture, which is the Nano Every. The program works fine and now I can have a lot bigger arrays for complex blinking action. But if I want to use Serial.print() for debugging the Arduino resets and sometimes prints � in the serial monitor, sometimes nothing.

I read in another thread that Serial.print() resetting the Arduino indicates memory problems, like writing outside of an array. But it doesnt happen on the Micro and it happens even before the first call of any array. Serial.print() works normal until I call the first function in Loop().

Is there a difference between the Micro and Nano Every that I am missing? Can the problem be the declaration of my arrays, because it already happens before the arrays are called? I have the <avrdude: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description> error message, but people say this can be ignored.

Please post your sketch, using code tags when you do

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.

Ok, I will try to delete as much stuff as possible, so you dont have to read through all 11 kB. The Auto Format shifted my arrays around, thats not great. I had the numbers aligned in rows.

Don't worry much about that, we can 'see' past that as long as the code still compiles. IF you reduce your code, you'll likely change, or eradicate the problem, so it would be better if you present the problematic code with no changes, just formatted. We can talk about what we see then.

Before I post all of it, here is the function I think causes the problem. I had issues with going outside the array, but then i put in the contrain().

//int spectrometer[4][5][21]
void sap(int speed, int sapmode) {
  if (random(0, 3) == 0) {
    int x = random(0, 5);
    int y = random(0, 21);
    if (spectrometer[2][x][y] == 0) spectrometer[2][x][y] = 100;
  }
  for (int i = 0; i < 5; i++) {
    for (int j = 0; j < 21; j++) {
      switch (spectrometer[2][i][j]) {
        case 100:
          if (j == 20) bcount++;
          if (sapmode == 1) spectrometer[2][i][constrain(j + spectrometer[3][i][j], 0, 20)] = 100;
          else spectrometer[2][i][constrain(j + spectrometer[1][i][j], 0, 20)] = 100;
          spectrometer[2][i][j] = 50;
          if (spectrometer[3][i][j] == 1 && sapmode == 1) j++;
          else if (spectrometer[1][i][j] == 1 && sapmode == 0) j++;
          break;
        case 50:
          spectrometer[2][i][j] = 20;
          break;
        case 20:
          spectrometer[2][i][j] = 0;
          break;
        default:
          break;
      }
    }
  }
  if (sapmode == 1)
    for (int i = 0; i < 5; i++)
      for (int j = 0; j < 21; j++) pixels.setPixelColor(spectrometer[0][i][j], pixels.Color(spectrometer[2][i][j], max(0, 10 * spectrometer[3][i][j]), max(0, -10 * spectrometer[3][i][j])));
  else
    for (int i = 0; i < 5; i++)
      for (int j = 0; j < 21; j++) pixels.setPixelColor(spectrometer[0][i][j], pixels.Color(spectrometer[2][i][j], max(0, 10 * spectrometer[1][i][j]), max(0, -10 * spectrometer[1][i][j])));
  pixels.show();
  delay(speed);
  bdetector();
}

What I find strange is, if I remove any calls to this function, the problem with Serial.print() goes away. So the IDE doesnt compile functions that are never called? But then if I leave the calls in the program, why does it fail before the problematic function is even called? It must be that compiling this function already causes the problem, not actually runing it.

Please post your full sketch. It is important to be able to see how all of your variables are declared

Sorry, I was busy yesterday. Here is the full sketch. Dont say I didnt warn you :slight_smile:

As I said, the problem seems to be in the sap() function.

#include <Adafruit_NeoPixel.h>
#define PIN 6
#define NUMPIXELS 221
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_RGB + NEO_KHZ800);

//electron paths and variables
int paths[7][69] = {
  { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  56, 57, 300, 300 },
  { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,  58,  59,  60,  61,  62,  63,  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78, 55,  56,  57 },
  { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,  36,  79,  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,  96,  55,  56, 57, 300, 300 },
  { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,  36,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,  55,  56, 57, 300, 300 },
  { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 55,  56,  57 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10, 20, 30,  40,  50,  60,  70,  80,  90,  95,  90,  80,  70,  60,  50,  40,  30,  20,  10,   0,   0,   0,   0,   0,  0,   0,   0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,   0,   0,   8,   8,   8,   8,   8,   8,   8,   7,   7,   0,  -8,  -8,  -8,  -8,  -8,  -8,  -8,  -8,   0,  0,   0,   0 }
};
int dety[36];
int beamline[136] = { 0 };

//tritium paths
int trit[3][14] = {
  { 200, 203, 206, 198,   6,  12, 196, 211, 208, 15, 18, 218, 217, 214 },
  { 201, 204, 207,   8,   5,  10,  13, 197, 210, 16, 19, 219, 216, 213 },
  { 202, 205, 199,   7,   4,  11,  14, 212, 209, 17, 20, 220, 215, 212 }
};


//game variables
int gameboard[5] = { 18, 13, 10, 7, 5 }; //size of the target area
int scoreboard[5] = { 0, 1, 9, 21, 37 };
int difficulty[5] = { 0, 5, 10, 12, 15 }; //game speed
int stage = 0;


//SAP variables
int spectrometer[4][5][21] = {
  { {  58,  59,  60,  61,  62,  63,  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78 },
    {  35,  36,  79,  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,  92,  93,  94,  95,  96,  54 },
    {  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55 },
    {  35,  36,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,  54 },
    { 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135 } },

  { { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
    { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
    { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
    { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
    { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } },

  { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },

  { { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1 },
    { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1 },
    { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1 },
    { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1 },
    { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1 } }
};

float bdet = 10;
int bcount = 0;



void setup() {
  pinMode(3, INPUT);
  pixels.begin(); 
  Serial.begin(9600);
  delay(1000);
}


void loop() {
  
  //Serial.println("Here I work fine");
  detectorwipe(50);
  //Serial.println("Here I reset");
  if (digitalRead(3) == HIGH) game();

    for (int i = 0; i < 3; i++) {
      if (digitalRead(3) == HIGH) return;
      egun(20);
    }
    delay(1000);
    for (int j = 0; j < 3; j++) {
      tritium(80, 20);
      if (digitalRead(3) == HIGH) return;
      delay(1000);
      decay(160);
      if (digitalRead(3) == HIGH) return;
      delay(1000);
      decay(160);
      if (digitalRead(3) == HIGH) return;
      delay(1000);

      for (int i = 0; i < 8; i++) {
        if (digitalRead(3) == HIGH) return;
        if (random(10) < 8) electron(random(55, 90), random(5));
        else electron(-random(60, 80), random(5));
        delay(random(500, 1500));
      }
    }
    detectorwipe(50);
    if (digitalRead(3) == HIGH) return;
    for (int i = 0; i < 200; i++) sap(100, 0);
    if (digitalRead(3) == HIGH) return;
    for (int i = 0; i < 200; i++) sap(100, 1);

    for (int i = 0; i < NUMPIXELS; i++) {
      pixels.setPixelColor(i, pixels.Color(00, 00, 00));
      pixels.show();
      delay(1);
    }
    delay(1000);
  }


void game() {
  for (int i = 0; i < 58; i++) {
    pixels.setPixelColor(i, pixels.Color(0, 50, 0));
    if (i + gameboard[stage] > 58) pixels.setPixelColor(i, pixels.Color(35, 00, 0));
  }
  pixels.show();
  int dir = 1;
  int pos = 0;

  while (digitalRead(3) == HIGH) delay(100);
  while (1) {
    for (int i = 0; i < 58; i++) {
      pixels.setPixelColor(i, pixels.Color(0, 50, 0));
      if (i + gameboard[stage] > 58) pixels.setPixelColor(i, pixels.Color(35, 00, 0));
    }
    pixels.setPixelColor(pos, pixels.Color(0, 0, 150));
    pixels.show();
    delay(20 - difficulty[stage]);
    if (dir == 1) pos++;
    else pos--;
    if (pos > 56) dir = 0;
    if (pos < 1) dir = 1;
    if (digitalRead(3) == HIGH) {
      if (pos + gameboard[stage] -1 > 58) {
        delay(500);
        gamewipe();
        electron(95 + pos - 58, random(5));
        if (stage == 4) {
          win();
          stage = 0;
          break;
        }
        stage++;
        pos = 0;
        dir = 1;
        showscoreboard();
        delay(500);
      } else {
        stage = 0;
        delay(500);
        gamewipe();
        if (pos > 25) electron(pos + 10, random(5));
        else electron(pos - 40, random(5));
        loose();
        break;
      }
    }
  }
}


void gamewipe() {
  for (int i = 0; i < 58; i++) pixels.setPixelColor(i, pixels.Color(0, 0, 0));
  pixels.show();
}


void loose() {
  delay(1000);
  for (int i = 0; i < 173; i++) {
    pixels.setPixelColor(i, pixels.Color(00, 50, 00));
    pixels.show();
    delay(10);
  }
  delay(1000);
  for (int i = 0; i < NUMPIXELS; i++) pixels.setPixelColor(i, pixels.Color(00, 00, 00));
  pixels.show();
  delay(1000);
}


void win() {
  delay(2000);
  for (long i = 0; i < 2 * 65536; i += 256) {
    pixels.rainbow(i, 4, 255, 80, false);
    pixels.show();
  }
  for (int i = 0; i < NUMPIXELS; i++) {
    pixels.setPixelColor(i, pixels.Color(00, 00, 00));
    pixels.show();
    delay(10);
  }
}


void showscoreboard() {
  for (int i = 0; i < 37; i++) {
    if (i < scoreboard[stage]) pixels.setPixelColor(i + 136, pixels.Color(0, 0, 100));
    else pixels.setPixelColor(i + 136, pixels.Color(0, 0, 0));
  }
}


void detectorwipe(int speed) {
  for (int i = 37; i > 0; i--) {
    pixels.setPixelColor(i + 135, pixels.Color(0, 0, 0));
    pixels.show();
    dety[i] = 0;
    delay(speed);
  }
}


void sap(int speed, int sapmode) {
  if (random(0, 3) == 0) {
    int x = random(0, 5);
    int y = random(0, 21);
    if (spectrometer[2][x][y] == 0) spectrometer[2][x][y] = 100;
  }
  for (int i = 0; i < 5; i++) {
    for (int j = 0; j < 21; j++) {
      switch (spectrometer[2][i][j]) {
        case 100:
          if (j == 20) bcount++;
          if (sapmode == 1) spectrometer[2][i][constrain(j + spectrometer[3][i][j], 0, 20)] = 100;
          else spectrometer[2][i][constrain(j + spectrometer[1][i][j], 0, 20)] = 100;
          spectrometer[2][i][j] = 50;
          if (spectrometer[3][i][j] == 1 && sapmode == 1) j++;
          else if (spectrometer[1][i][j] == 1 && sapmode == 0) j++;
          break;
        case 50:
          spectrometer[2][i][j] = 20;
          break;
        case 20:
          spectrometer[2][i][j] = 0;
          break;
        default:
          break;
      }
    }
  }
  if (sapmode == 1)
    for (int i = 0; i < 5; i++)
      for (int j = 0; j < 21; j++) pixels.setPixelColor(spectrometer[0][i][j], pixels.Color(spectrometer[2][i][j], max(0, 10 * spectrometer[3][i][j]), max(0, -10 * spectrometer[3][i][j])));
  else
    for (int i = 0; i < 5; i++)
      for (int j = 0; j < 21; j++) pixels.setPixelColor(spectrometer[0][i][j], pixels.Color(spectrometer[2][i][j], max(0, 10 * spectrometer[1][i][j]), max(0, -10 * spectrometer[1][i][j])));
  pixels.show();
  delay(speed);
  bdetector();
}


void bdetector() {
  bdet += bcount;
  bcount = 0;
  bdet -= 0.015 * bdet;
  for (int i = 0; i < 16; i++) {
    if (i < bdet) pixels.setPixelColor(i + 157, pixels.Color(0, 100, 0));
    else pixels.setPixelColor(i + 157, pixels.Color(0, 0, 0));
  }
  pixels.show();
}


void egun(int speed) {
  if (digitalRead(3) == HIGH) return;
  int pix = random(136, 144);
  for (int i = 0; i < 20; i++) {
    pixels.setPixelColor(0, pixels.Color(2 * i, 7 * i, 0));
    pixels.show();
    delay(speed);
  }
  for (int i = 0; i < 57; i++) {
    pixels.setPixelColor(paths[0][i], pixels.Color(20, 80, 0));
    pixels.show();
    delay(speed);
  }
  delay(5 * speed);
  pixels.setPixelColor(pix, pixels.Color(30, 100, 0));
  pixels.show();
  delay(speed);
  pixels.setPixelColor(0, pixels.Color(0, 0, 0));
  pixels.show();
  delay(speed);
  for (int i = 0; i < 57; i++) {
    pixels.setPixelColor(paths[0][i], pixels.Color(0, 0, 0));
    pixels.show();
    delay(speed);
  }
  pixels.setPixelColor(pix, pixels.Color(0, 0, 0));
  pixels.show();
  delay(speed);
}


void tritium(int speed, int length) {
  if (digitalRead(3) == HIGH) return;
  for (int l = 0; l < length; l++) {
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 14; j++) pixels.setPixelColor(trit[i][j], pixels.Color(0, 0, 150));
      pixels.show();
      delay(speed);
      for (int j = 0; j < 14; j++) pixels.setPixelColor(trit[i][j], pixels.Color(0, 0, 0));
      pixels.show();
    }
  }
}


void detector() {
  int rannum;
  for (int i = 0; i < 10; i++) {
    rannum = random(36);
    if (dety[rannum] == 0) break;
  }
  dety[rannum] = 80;
  pixels.setPixelColor(rannum + 136, pixels.Color(dety[rannum] * 0.8, dety[rannum], 0));
  pixels.show();
}


//speed s, spectrometer path p
void electron(int s, int p) {
  int ele = random(5, 13);
  pixels.setPixelColor(paths[p][ele], pixels.Color(100, 100, 100));
  pixels.show();
  delay(100 - abs(s));
  for (int i = ele; i < 59; i++) {
    s -= paths[6][i];
    beam(paths[p][i]);
    delay(100 - abs(s));
    if (s < 0) i -= 2;
    if (i < -1) break;
  }
  for (int i = 0; i < 3; i++) {
    beam(0);
    delay(100 - abs(s));
  }
  if (s > 50) {
    detector();
  }
}


void beam(int led) {
  if (led > 0) beamline[led] = 100;
  for (int i = 1; i < 136; i++) {
    pixels.setPixelColor(i, pixels.Color(beamline[i] * 60 / 100, beamline[i] * 100 / 100, 0));
    if (i == 57) pixels.setPixelColor(57, pixels.Color(0, beamline[i] * 150 / 100, 0));
    if (i == 1) pixels.setPixelColor(1, pixels.Color(0, beamline[i] * 150 / 100, 0));
    if (beamline[i] > 0) beamline[i] /= 3;
    if (beamline[i] < 10) beamline[i] = 0;
  }
  pixels.show();
}


void decay(int speed) {
  if (digitalRead(3) == HIGH) return;
  for (int i = 173; i < 177; i++) {
    pixels.setPixelColor(i, pixels.Color(0, 0, 150));
    pixels.show();
    delay(speed);
    pixels.setPixelColor(i, pixels.Color(0, 0, 0));
    pixels.show();
  }
  for (int i = 0; i < 10; i++) {
    pixels.setPixelColor(177, pixels.Color(100, 100, 100));
    pixels.show();
    delay(speed / 5);
    pixels.setPixelColor(177, pixels.Color(0, 0, 0));
    pixels.show();
    delay(speed / 5);
  }

  for (int i = 0; i < 48; i++) {
    if (i % 6 == 0) {
      pixels.setPixelColor(178 + (i / 6) - 1, pixels.Color(0, 0, 0));
      pixels.setPixelColor(178 + (i / 6), pixels.Color(0, 120, 0));
    }
    if (i % 8 == 0) {
      pixels.setPixelColor(186 + (i / 8) - 1, pixels.Color(0, 0, 0));
      pixels.setPixelColor(186 + (i / 8), pixels.Color(60, 100, 0));
    }
    if (i % 12 == 0) {
      pixels.setPixelColor(192 + (i / 12) - 1, pixels.Color(0, 0, 0));
      pixels.setPixelColor(192 + (i / 12), pixels.Color(100, 0, 0));
    }
    pixels.show();

    delay(speed / 12);
  }
  for (int i = 173; i < 196; i++) pixels.setPixelColor(i, pixels.Color(0, 0, 0));
  pixels.show();
  delay(speed);
}


void count() {
  for (int i = 0; i < NUMPIXELS + 4; i++) {
    pixels.setPixelColor(i, pixels.Color(50, 0, 0));
    if (i % 10 == 0) pixels.setPixelColor(i, pixels.Color(0, 50, 0));
  }
  pixels.show();
}

When I compile your code for the Every, I see that the dynamic RAM allocated seems to be fewer bytes than I expected, given the number of global ints declared at the top of the code. Makes me think some of that is unreferenced, and therefore discarded by the compiler automatically. That would explain even compiling on the Nano, if you didn't reference one of the large arrays(i.e. only sap() referenced a large array, but sap() was commented out).
So it would seem that even now, on the Every, some of that data is not referenced and therefore discarded.
Have you looked at the compiler's output to see if there are hints there? Go to Preferences, and turn up compiler output, then recompile and dig through the output. If you want, post the complete compilation output here for inspection.

As I thought, the large array (spectrometer[][][]) is only referenced within sap(), and therefore if sap() is never called, both the function and the array are eliminated by the compiler.

Once the array is referenced(inferred by a reference to sap()), the array is compiled. Changes the amount of memory used quite significantly, but I'm not yet seeing the root problem. TBD.

As an aside, I presume you have a pulldown resistor on pin 3, and that your button pulls the pin to 5V when pressed. If the pulldown isn't present, your sensing of pin 3's state will be erratic.

The sketch uses 13028 kB of flash memory and 2457 kB of sRAM on a micro, but 11754 kB of flash memory and 1405 kB of RAM on a nano every. No idea how this works. Since the sketch runs fine I dont think the nano every is loosing data.

Yes, the button has a pulldown resistor.

Here is the compiler output. Sorry for the German in there, my IDE is set to English.

FQBN: arduino:megaavr:nona4809:mode=off
Using board 'nona4809' from platform in folder: C:\Users\x\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8
Using core 'arduino' from platform in folder: C:\Users\x\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8

Verwendete Bibliotheken erkennen ...
C:\Users\x\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega4809 -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO_EVERY -DARDUINO_ARCH_MEGAAVR -DMILLIS_USE_TIMERB3 -DNO_EXTERNAL_I2C_PULLUP -IC:\Users\x\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\cores\arduino/api/deprecated -IC:\Users\x\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\cores\arduino -IC:\Users\x\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\variants\nona4809 C:\Users\x\AppData\Local\Temp\arduino\sketches\34152714B6AC21BB4C92691033658340\sketch\KATRIN_LED_Modell_4_game.ino.cpp -o nul
Alternativen für Adafruit_NeoPixel.h: [Adafruit NeoPixel@1.12.3]
ResolveLibrary(Adafruit_NeoPixel.h)
  -> Kandidaten: [Adafruit NeoPixel@1.12.3]
C:\Users\x\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega4809 -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO_EVERY -DARDUINO_ARCH_MEGAAVR -DMILLIS_USE_TIMERB3 -DNO_EXTERNAL_I2C_PULLUP -IC:\Users\x\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\cores\arduino/api/deprecated -IC:\Users\x\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\cores\arduino -IC:\Users\x\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\variants\nona4809 -IC:\Users\x\Documents\Arduino\libraries\Adafruit_NeoPixel C:\Users\x\AppData\Local\Temp\arduino\sketches\34152714B6AC21BB4C92691033658340\sketch\KATRIN_LED_Modell_4_game.ino.cpp -o nul
Using cached library dependencies for file: C:\Users\x\Documents\Arduino\libraries\Adafruit_NeoPixel\Adafruit_NeoPixel.cpp
Using cached library dependencies for file: C:\Users\x\Documents\Arduino\libraries\Adafruit_NeoPixel\esp.c
Using cached library dependencies for file: C:\Users\x\Documents\Arduino\libraries\Adafruit_NeoPixel\esp8266.c
Using cached library dependencies for file: C:\Users\x\Documents\Arduino\libraries\Adafruit_NeoPixel\kendyte_k210.c
Funktionsprototypen werden generiert ...
C:\Users\x\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega4809 -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO_EVERY -DARDUINO_ARCH_MEGAAVR -DMILLIS_USE_TIMERB3 -DNO_EXTERNAL_I2C_PULLUP -IC:\Users\x\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\cores\arduino/api/deprecated -IC:\Users\x\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\cores\arduino -IC:\Users\x\AppData\Local\Arduino15\packages\arduino\hardware\megaavr\1.8.8\variants\nona4809 -IC:\Users\x\Documents\Arduino\libraries\Adafruit_NeoPixel C:\Users\x\AppData\Local\Temp\arduino\sketches\34152714B6AC21BB4C92691033658340\sketch\KATRIN_LED_Modell_4_game.ino.cpp -o C:\Users\x\AppData\Local\Temp\3183751610\sketch_merged.cpp
C:\Users\x\AppData\Local\Arduino15\packages\builtin\tools\ctags\5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives C:\Users\x\AppData\Local\Temp\3183751610\sketch_merged.cpp
Sketch wird kompiliert ...
"C:\\Users\\x\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino5/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega4809 -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_NANO_EVERY -DARDUINO_ARCH_MEGAAVR -DMILLIS_USE_TIMERB3 -DNO_EXTERNAL_I2C_PULLUP "-IC:\\Users\\x\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\megaavr\\1.8.8\\cores\\arduino/api/deprecated" "-IC:\\Users\\x\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\megaavr\\1.8.8\\cores\\arduino" "-IC:\\Users\\x\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\megaavr\\1.8.8\\variants\\nona4809" "-IC:\\Users\\x\\Documents\\Arduino\\libraries\\Adafruit_NeoPixel" "C:\\Users\\x\\AppData\\Local\\Temp\\arduino\\sketches\\34152714B6AC21BB4C92691033658340\\sketch\\KATRIN_LED_Modell_4_game.ino.cpp" -o "C:\\Users\\x\\AppData\\Local\\Temp\\arduino\\sketches\\34152714B6AC21BB4C92691033658340\\sketch\\KATRIN_LED_Modell_4_game.ino.cpp.o"
Bibliotheken werden kompiliert ...
Bibliothek "Adafruit NeoPixel" wird kompiliert
Zuvor kompilierte Datei wird verwendet: C:\Users\x\AppData\Local\Temp\arduino\sketches\34152714B6AC21BB4C92691033658340\libraries\Adafruit_NeoPixel\esp8266.c.o
Zuvor kompilierte Datei wird verwendet: C:\Users\x\AppData\Local\Temp\arduino\sketches\34152714B6AC21BB4C92691033658340\libraries\Adafruit_NeoPixel\kendyte_k210.c.o
Zuvor kompilierte Datei wird verwendet: C:\Users\x\AppData\Local\Temp\arduino\sketches\34152714B6AC21BB4C92691033658340\libraries\Adafruit_NeoPixel\esp.c.o
Zuvor kompilierte Datei wird verwendet: C:\Users\x\AppData\Local\Temp\arduino\sketches\34152714B6AC21BB4C92691033658340\libraries\Adafruit_NeoPixel\Adafruit_NeoPixel.cpp.o
Kern wird kompiliert ...
Zuvor kompilierte Datei wird verwendet: C:\Users\x\AppData\Local\Temp\arduino\sketches\34152714B6AC21BB4C92691033658340\core\variant.c.o
Using precompiled core: C:\Users\x\AppData\Local\Temp\arduino\cores\arduino_megaavr_nona4809_mode_off_511d907636b8ca1cb6392dab3b59f92a\core.a
Linking everything together...
"C:\\Users\\x\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino5/bin/avr-gcc" -Wall -Wextra -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -Wl,--section-start=.text=0x0 -mmcu=atmega4809 -o "C:\\Users\\x\\AppData\\Local\\Temp\\arduino\\sketches\\34152714B6AC21BB4C92691033658340/KATRIN_LED_Modell_4_game.ino.elf" "C:\\Users\\x\\AppData\\Local\\Temp\\arduino\\sketches\\34152714B6AC21BB4C92691033658340\\sketch\\KATRIN_LED_Modell_4_game.ino.cpp.o" "C:\\Users\\x\\AppData\\Local\\Temp\\arduino\\sketches\\34152714B6AC21BB4C92691033658340\\libraries\\Adafruit_NeoPixel\\Adafruit_NeoPixel.cpp.o" "C:\\Users\\x\\AppData\\Local\\Temp\\arduino\\sketches\\34152714B6AC21BB4C92691033658340\\libraries\\Adafruit_NeoPixel\\esp.c.o" "C:\\Users\\x\\AppData\\Local\\Temp\\arduino\\sketches\\34152714B6AC21BB4C92691033658340\\libraries\\Adafruit_NeoPixel\\esp8266.c.o" "C:\\Users\\x\\AppData\\Local\\Temp\\arduino\\sketches\\34152714B6AC21BB4C92691033658340\\libraries\\Adafruit_NeoPixel\\kendyte_k210.c.o" "C:\\Users\\x\\AppData\\Local\\Temp\\arduino\\sketches\\34152714B6AC21BB4C92691033658340\\core\\variant.c.o" "C:\\Users\\x\\AppData\\Local\\Temp\\arduino\\sketches\\34152714B6AC21BB4C92691033658340/..\\..\\cores\\arduino_megaavr_nona4809_mode_off_511d907636b8ca1cb6392dab3b59f92a\\core.a" "-LC:\\Users\\x\\AppData\\Local\\Temp\\arduino\\sketches\\34152714B6AC21BB4C92691033658340" -lm "-Wl,-Map,C:\\Users\\x\\AppData\\Local\\Temp\\arduino\\sketches\\34152714B6AC21BB4C92691033658340/KATRIN_LED_Modell_4_game.ino.map"
"C:\\Users\\x\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino5/bin/avr-objcopy" -O binary -R .eeprom "C:\\Users\\x\\AppData\\Local\\Temp\\arduino\\sketches\\34152714B6AC21BB4C92691033658340/KATRIN_LED_Modell_4_game.ino.elf" "C:\\Users\\x\\AppData\\Local\\Temp\\arduino\\sketches\\34152714B6AC21BB4C92691033658340/KATRIN_LED_Modell_4_game.ino.bin"
"C:\\Users\\x\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino5/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\x\\AppData\\Local\\Temp\\arduino\\sketches\\34152714B6AC21BB4C92691033658340/KATRIN_LED_Modell_4_game.ino.elf" "C:\\Users\\x\\AppData\\Local\\Temp\\arduino\\sketches\\34152714B6AC21BB4C92691033658340/KATRIN_LED_Modell_4_game.ino.eep"
"C:\\Users\\x\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino5/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\x\\AppData\\Local\\Temp\\arduino\\sketches\\34152714B6AC21BB4C92691033658340/KATRIN_LED_Modell_4_game.ino.elf" "C:\\Users\\x\\AppData\\Local\\Temp\\arduino\\sketches\\34152714B6AC21BB4C92691033658340/KATRIN_LED_Modell_4_game.ino.hex"

Bibliothek Adafruit NeoPixel in Version 1.12.3 im Ordner: C:\Users\x\Documents\Arduino\libraries\Adafruit_NeoPixel  wird verwendet
"C:\\Users\\x\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino5/bin/avr-size" -A "C:\\Users\\x\\AppData\\Local\\Temp\\arduino\\sketches\\34152714B6AC21BB4C92691033658340/KATRIN_LED_Modell_4_game.ino.elf"
Der Sketch verwendet 11754 Bytes (23%) des Programmspeicherplatzes. Das Maximum sind 49152 Bytes.
Globale Variablen verwenden 1405 Bytes (22%) des dynamischen Speichers, 4739 Bytes für lokale Variablen verbleiben. Das Maximum sind 6144 Bytes.
Performing 1200-bps touch reset on serial port COM11
"C:\Users\x\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\x\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -V -patmega4809 -cjtag2updi -PCOM11  -b115200 -e -D "-Uflash:w:C:\Users\x\AppData\Local\Temp\arduino\sketches\34152714B6AC21BB4C92691033658340/KATRIN_LED_Modell_4_game.ino.hex:i" "-Ufuse2:w:0x01:m" "-Ufuse5:w:0xC9:m" "-Ufuse8:w:0x00:m" {upload.extra_files}

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\x\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port                    : COM11
         Using Programmer              : jtag2updi
         Overriding Baud Rate          : 115200
JTAG ICE mkII sign-on message:
Communications protocol version: 1
M_MCU:
  boot-loader FW version:        1
  firmware version:              1.07
  hardware version:              1
S_MCU:
  boot-loader FW version:        1
  firmware version:              6.07
  hardware version:              1
Serial number:                   00:00:00:00:00:00
Device ID:                       JTAGICE mkII
         AVR Part                      : ATmega4809
         Chip Erase delay              : 0 us
         PAGEL                         : P00
         BS2                           : P00
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 0
         StabDelay                     : 0
         CmdexeDelay                   : 0
         SyncLoops                     : 0
         ByteDelay                     : 0
         PollIndex                     : 0
         PollValue                     : 0x00
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           prodsig        0     0     0    0 no         61   61      0     0     0 0x00 0x00
           fuses          0     0     0    0 no          9    0      0     0     0 0x00 0x00
           fuse0          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse1          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse2          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse4          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse5          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse6          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse7          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse8          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           lock           0     0     0    0 no          1    0      0     0     0 0x00 0x00
           data           0     0     0    0 no          0    0      0     0     0 0x00 0x00
           usersig        0     0     0    0 no         64   64      0     0     0 0x00 0x00
           flash          0     0     0    0 no      49152  128      0     0     0 0x00 0x00
           eeprom         0     0     0    0 no        256   64      0     0     0 0x00 0x00

         Programmer Type : JTAGMKII_PDI
         Description     : JTAGv2 to UPDI bridge
         M_MCU hardware version: 1
         M_MCU firmware version: 1.07
         S_MCU hardware version: 1
         S_MCU firmware version: 6.07
         Serial number:          00:00:00:00:00:00
         Vtarget         : 5.0 V

avrdude: jtagmkII_initialize(): Cannot locate "flash" and "boot" memories in description
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.27s

avrdude: Device signature = 0x1e9651 (probably m4809)
avrdude: erasing chip
avrdude: reading input file "C:\Users\x\AppData\Local\Temp\arduino\sketches\34152714B6AC21BB4C92691033658340/KATRIN_LED_Modell_4_game.ino.hex"
avrdude: writing flash (11754 bytes):

Writing | ################################################## | 100% 8.60s

avrdude: 11754 bytes of flash written
avrdude: reading input file "0x01"
avrdude: writing fuse2 (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of fuse2 written
avrdude: reading input file "0xC9"
avrdude: writing fuse5 (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of fuse5 written
avrdude: reading input file "0x00"
avrdude: writing fuse8 (1 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 1 bytes of fuse8 written

avrdude done.  Thank you.

Can the nano every use compression? Because I have a lot of zeros and repeating stuff in my arrays?

compression? No.
Your code, my Every:

Sketch uses 11754 bytes (23%) of program storage space. Maximum is 49152 bytes.
Global variables use 1405 bytes (22%) of dynamic memory, leaving 4739 bytes for local variables. Maximum is 6144 bytes.

I have no idea where you got this:

Oh, I meant bytes, not kB. I just compiled it for each board. Strange that there is such a big difference.