Due "ONE MORE VARIABLE" bug

Hello friends,

The code posted works on my Due, however, when I try and add ONE more variable (int, float....) to the code the Due will not work even though it compiles, uploads, and shows CPU reset. This is quite frustrating as I have only used 8% of my Due's memory. What I mean by not work is the Due will not even start the Void Setup loop as I have put in a Serial.Print test to try and debug the issue. I am also using the RA8875 Library from Sumotoy if that might have anything to do with it. Any suggestions or ideas are welcome.

Thank you so much, Brett!

DUE.ino.ino (4.99 KB)

  for(int i = 0; i < sizeof(PIN_THERM); i++){

pinMode(PIN_THERM[i], OUTPUT);
    digitalWrite(PIN_THERM[i], HIGH);
  }

"sizeof()" returns the size of the argument IN BYTES (ie 8, instead of 2 for the two elements.)
So you end up doing a bunch of pinMode() calls on random values that happen to be in memory past the end of your array. Between C's lack of bounds checking, and the Arduino Library's lack of bound checking, bad things can happen

Hey buddy,

So after coming to my own conclusions, I thought it had to be the board itself since it was a Chinese knockoff without many hopes. It was definitely the error that you had pointed out and I can continue development.

Thank you so much, Brett!