Thank you very much for providing an alternative code, I have to be honest I don't understand most of it due to me being an ignorant beginner, but I tried to run it and nothing is showing on the screen.
And apologies for not providing an explanation about what I am trying to achieve with the code. I have provided some info about it inside the code after //, however it was probably not enough so let me explain.
This is the flow:
-
I input an arbitrary word (which can include digits as well) by turning the dial of the rotary encoder, which shows a letter or digit on the screen according to its value. Once the chosen letter or digit appears on the screen, I press the button (Key 2) and the letter/digit gets stored and I move onto the next one
-
I keep doing this until I have finished selecting all letters/digits, at which point I go to fadeValue2 ==36, which shows on the screen "show output" and press Key. This basically serves the function of a keyboard's "ctrl+enter" key if I were using serial monitor to input the word
-
once I press the key on fadeValue2=36, the program performs a calculation based on the ASCII value of each letter and the arbitrary value assigned to the digits that are stored in InputArrayCalc[100] (the arbitrary value of the digits is given by using the code
if (fadeValue2 >= 26) InputArrayCalc[InputArrayPos] = charselect+75). -
the calculation divides these values by 6 and stores the quotients and remainder in int num[2][100] (num[0][100] stores the quotients, num[1][100] stores the remainders). Based on how the calculation is set up, it should return values between 0-5 for both quotients and remainders
-
finally, these values are used as coordinates to go fetch the correspondent ASCII character in the matrix AlphaNumChart[6][6]
to give you an example, in case the initial input word is "az"
a=97, z=122
num[0][0] = (97 - 97) / 6=0; num[0][1] = (122- 97) / 6=4;
num[1][0] = (97 - 97) % 6=0; num[1][1] = (122 - 97) % 6=1;
this code then re-arranges the remainders in the opposite order and use the combination of quotients and remainders values as "coordinates" for the AlphaNumChart matrix
Output[i] = AlphaNumChart[num[0][i]][num[1][InputLen - 1 - i]]
so, the final result uses coordinates num[0][0]=0, num[1][1]=1 to find the first value 'g' and num[0][1]=4, num[1][0]=0 coordinates to find the second value 'e'.
The code should output the word "ge" on the screen as a final result.
I hope this is clear enough, It's a bit complex to explain, but I hope it can help understand the matter better.
Regarding your comment about the pull-up resistor, I have wired the components according to the tutorial that came with the Arduino when I bought it, therefore I believe it should all be wired up correctly... I am attaching here another photo where it's maybe easier to see how they are all connected (from left to right OLED, encoder, switch).
Please note, the first part of the code (the word inputting part) and the screen work perfectly as long as I remove the line calculateOutput(); from void calculateOutput(). I am able to see the letters/digits appearing, able to store them and have them appear as one word on the screen. It's when I add the "calculation" part of the code that everything freezes...
