Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define ENCODING_BYTE_DESIRED 0
- #define ENCODING_BYTE_USED 1
- #define ENCODING_BYTE_MODIFIER 2
- byte Encoding[3][100] = { //this is US encoding
- {0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x4D, 0x51, 0x57, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x69, 0x6D, 0x71, 0x77, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E},
- {0x31, 0x22, 0x33, 0x34, 0x35, 0x37, 0x22, 0x39, 0x30, 0x38, 0x3D, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3B, 0x3B, 0x2C, 0x3D, 0x2E, 0x2F, 0x32, 0x61, 0x6D, 0x71, 0x77, 0x79, 0x7A, 0x5B, 0x5C, 0x5D, 0x36, 0x2D, 0x7E, 0x61, 0x69, 0x6D, 0x71, 0x77, 0x79, 0x7A, 0x5B, 0x5C, 0x5D, 0x7E},
- {0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x00, 0x81, 0x81, 0x81, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x81, 0x00, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x00, 0x00, 0x00, 0x81, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x81, 0x81, 0x81}
- };
- void Print(char *inStr)
- {
- int enc_index;
- for(byte i=0; i<strlen(inStr); i++)
- {
- enc_index = GetKeyIndex(inStr[i], Encoding[ENCODING_BYTE_DESIRED]);
- if(enc_index < 256)
- {
- if(Encoding[ENCODING_BYTE_MODIFIER][enc_index] > 0)
- {
- Keyboard.press(Encoding[ENCODING_BYTE_MODIFIER][enc_index]);
- delay(5);
- }
- Keyboard.press(Encoding[ENCODING_BYTE_USED][enc_index]);
- delay(5);
- }
- else
- {
- Keyboard.press(inStr[i]);
- delay(5);
- }
- Keyboard.releaseAll();
- }
- }
- int GetKeyIndex(byte c, byte* char_array)
- {
- for(byte i=0;i<strlen(char_array);i++)
- {
- if(c == char_array[i])
- {
- return i;
- }
- }
- return 256;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement