Arduino teensy code for USB text keyboard

Download teensyduino here

Download arduino ide here

Here is the layout I am using for the xp120 currently.

Now to look at a portion of the code

Replace the keycodes with the ones you want. Visit the pjrc link in the code to see all available keycodes.

0 means that space is unused. You need a 0 in the ‘normal’ matrix spot when using a modifier there. Then in the ‘modifier’ section, type the modifier you want.

For macros, you only need to change the text in quotations at the top of the code where it says #define MACRO1_STRING

If you want to use this code with a different teensy. Then you need to

1. change the rowsSet and columnsSet numbers to correlate to your matrix.

2. change your pin I/O numbers to whichever ones you’re using.

3. change the matrix to match your rows and columns. As you can see in my code, the xp120 has 10 rows and 12 columns, using 22 pins. So the matrices are 10 rows with 12 keycodes or blank 0’s. Change each matrix including saveState and bounceTimer.

After you write out your code, flash it to the board using the upload button in arduino or teensyduino. You might need to push the white button on the teensy to reset the board. Look at the settings under teensyduino TOOLS. Make sure they match what is here. You need to change the USB Type when swapping between TEXT or MIDI boards.

Right now media macros like play and pause are not working with mac os like my apple keyboard does. I do not know how to use text and midi at the same time yet. I’ll have an update when I figure it out.