I wasn't sure where to put this post so I put it here. Mods, maybe a "prototypes" section under "project discussion and showcase" is warranted. Feel free to move the post if you don't like where it is.
I posted this because I just had to share it.
This keyboard is a prototype of something that will be attached to DataSleeve, and it uses a 12-key matrix keypad and a rotary encoder paired with an Arduino Micro to make complex alphanumerical inputs on a computer.
In other words, I can print the entire alphabet, and every digit, and every punctuation symbol with twelve buttons, WITHOUT making any weird complex button combinations.
It works like this:
The keypad has a specific keymap that it responds to, and pressing a key tells the software which button you've pressed as a number 1-12. This data is stored in an int called "key". The rotary encoder increments an int called "counter" whenever it moves one notch clockwise, and it decrements "counter" whenever it moves counterclockwise. Additional code keeps "counter" between 1 and 8.
The code has a 2D int array, which has 12 arrays, each with 8 elements.
Can you see where I'm going with this?
The code has a line- Keyboard.write(array1[key][counter]);
So if I pressed button 2, and the rotary encoder was set to 1, that line would mean Keyboard.write(array1[2][1]);
But what does that location in the array mean? Well, the array is filled with ASCII values (and some reference variables I put on the 0 values to make my life easier). So if we continue with the [2][1] value, that would return as "98". Which the Arduino would print to your keyboard, and "b" would appear on your screen. If I incremented the encoder one and pressed the same button, it would print "n".
How cool is that?
It does require setup, I have to write the 2D array to correspond properly. If I wanted to, that same location could return "." or "8" or "p". But that doesn't make sense.
Thoughts can be shared in the comments. I'm sure I'm not the first one to think of this idea, but it works remarkably well and I've never seen it before, so here it is for the community.