Is the problem in the code or in the OLED screen?

@blh64
Thank you for your clarification, now I understand! I went back and fixed a few things from the code according to your suggestions:

  1. To avoid selecting the inexistent 37th element from the chart, I added an IF statement that stops the code from searching for the 37th value in the array:
fadeValue2 = map(fadeValue1, 0, 1023, 0, 36);
  if (fadeValue2 != 36) charselect = Input[fadeValue2];
  1. I added some code to give an arbitrary value to the character '0' to '9'. As you correctly highlighted, the ASCII value would have not allowed for the calculation to be made ('0' = 48 and 48 - 96 = -48). To do this, I created another array, so I have two of them, one to store the input I want to show on the display (ASCII characters) and one array to store the correspondent value in the back-end, to use later in the code for the password calculation
char InputArrayCalc[100];

if (fadeValue2 < 26) InputArrayCalc[InputArrayPos] = charselect;
if (fadeValue2 >= 26) InputArrayCalc[InputArrayPos] = charselect+75;
  1. I also added the code to make sure the arrays are null terminated:
    InputArray[InputArrayPos] = charselect;
      if (fadeValue2 < 26) InputArrayCalc[InputArrayPos] = charselect;
      if (fadeValue2 >= 26) InputArrayCalc[InputArrayPos] = charselect+75;
    InputArrayPos = InputArrayPos + 1;
    InputArray[InputArrayPos] = '\0';
    InputArrayCalc[InputArrayPos] = '\0';
  1. and lastly, I also changed the calculation Dividing by 5 would have returned values that are not within the possible options available to use as coordinate to fetch the correspondent value in char AlphaNumChart[6][6]. Now it's dividing by 6 instead of 5, which will return values between 0-5, therefore usable to address a [6][6] matrix:
void calculateOutput() {
  for (int i = 0; i < (InputLen - 1); i++) {
    num[0][i] = (InputArrayCalc[i] - 97) / 6;
    num[1][i] = (InputArrayCalc[i] - 97) % 6;

After doing all this, I wish I could say that the code finally started working, however unfortunately that was not the case :sob: :sob:

Is there something else that I am missing in the rest of the code that is causing it not to run? Just in case, I am pasting the entire code again below after the modification

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128  // OLED display width, in pixels
#define SCREEN_HEIGHT 64  // OLED display height, in pixels

// On an arduino UNO:       A4(SDA), A5(SCL)
#define OLED_RESET 4         // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C  ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);


char InputArray[100]; // stores the selected value from char Input
char InputArrayCalc[100]; // stores the selected value to run calculation
char Output[100]; // stores the final result to show on screen
char Input[36] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; // shows value on screen and allows selection to store in char InputArray
char AlphaNumChart[6][6] = { { 'a', 'b', 'c', 'd', 'e', 'f' },
                             { 'g', 'h', 'i', 'j', 'k', 'l' },
                             { 'm', 'n', 'o', 'p', 'q', 'r' },
                             { 's', 't', 'u', 'v', 'w', 'x' },
                             { 'y', 'z', '0', '1', '2', '3' },
                             { '4', '5', '6', '7', '8', '9' } }; // based on coordinates calculated by the formula, will select characters from this matrix to store in char Output

int num[2][100];  //first row to store reminder, second row to store quotients
int InputLen;
int i;
int Key = 2; // key to allow selection of the value to store in char InputArray
int fadeValue1; // raw potentiometer value
int fadeValue2; // potentiometer value adjusted to select one of the 36 options from char Input
char charselect; // to show and store selected value from char Input
int InputArrayPos = 0; //this is just for word positioning on the display
int cursor; // this is just for word positioning on the display
int CursorStart; // this is just for word positioning on the display
int CursorRef;  // this is just for word positioning on the display
int CursorEnd;  // this is just for word positioning on the display

void setup() {
  pinMode(Key, INPUT);
  Serial.begin(9600);
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  display.setTextWrap(false);
  display.clearDisplay();
}

void loop() {

  fadeValue1 = analogRead(A0);
  fadeValue2 = map(fadeValue1, 0, 1023, 0, 36);
  if (fadeValue2 != 36) charselect = Input[fadeValue2];

  display.clearDisplay();
  displayPrint(0, 0, WHITE, 1);
  display.println("Your selection:");

  displayPrint(55, 15, WHITE, 4);
  display.println(charselect);

  if (fadeValue2 == 36) {
    display.clearDisplay();
    displayPrint(0, 22, WHITE, 2);
    display.println("SHOW Output");
  }

  displayPrint(cursor, 47, WHITE, 2);
  display.println(InputArray);

  display.display();

  if ((digitalRead(Key) == 1) && (fadeValue2 != 36)) {

    InputArray[InputArrayPos] = charselect;
      if (fadeValue2 < 26) InputArrayCalc[InputArrayPos] = charselect;
      if (fadeValue2 >= 26) InputArrayCalc[InputArrayPos] = charselect+75;
    InputArrayPos = InputArrayPos + 1;
    InputArray[InputArrayPos] = '\0';
    InputArrayCalc[InputArrayPos] = '\0';

    display.clearDisplay();
    displayPrint(0, 0, WHITE, 1);
    display.println("Your selection:");
    displayPrint(50, 22, WHITE, 2);
    display.println("OK!");

    InputLen = (strlen(InputArray));
    if (InputLen > 10) {
      cursor = (10 - InputLen) * 12;
    } else
      cursor = 0;

    displayPrint(cursor, 47, WHITE, 2);
    display.println(InputArray);
    display.display();

    delay(500);
  }


  while ((digitalRead(Key) == 1) && (fadeValue2 == 36)) {

   calculateOutput(); 
   displayOutput();
  }
}

void calculateOutput() {

  for (int i = 0; i < (InputLen - 1); i++) {
    num[0][i] = (InputArrayCalc[i] - 97) / 6;
    num[1][i] = (InputArrayCalc[i] - 97) % 6;
  }
 
 for (int i = 0; i < (InputLen - 1); i++) {
     Output[i] = AlphaNumChart[num[0][i]][num[1][InputLen - 1 - i]];
  }

}

void displayOutput() {

  CursorEnd = (-12 * InputLen) + display.width();
  CursorStart = 0;

  while (digitalRead(Key) == 1) {

    if (InputLen <= 10) {
      display.clearDisplay();
      displayPrint(0, 0, WHITE, 1);
      display.println("Your Output:");

      displayPrint(0, 27, WHITE, 2);
      display.println(Output);
      display.display();
    }

    if (InputLen > 10) {
      display.clearDisplay();
      displayPrint(0, 0, WHITE, 1);
      display.println("Your Output:");
      displayPrint(CursorStart, 27, WHITE, 2);
      display.println(Output);
      display.display();
      if (CursorStart == 0) {CursorStart = CursorStart - 2; CursorRef = 0; delay(1000);}
      if ((CursorStart < 0) && (CursorRef == 0)) CursorStart = CursorStart - 2;
      if (CursorStart == CursorEnd) {CursorStart = CursorStart + 2; CursorRef = 1; delay(1000);}
      if ((CursorStart < 0) && (CursorRef == 1)) CursorStart = CursorStart + 2;
    }
  }
}

void displayPrint(int x, int y, int color, int size) {
  display.setCursor(x, y);
  display.setTextColor(color);
  display.setTextSize(size);
}