user83196: I'm trying to make a macro keyboard, where I can press a single button and it will open programs for me.
I'm trying to type this, for example: "c:\windows"
but it gets typed out like this: cÑ}windows
I tried using double backslash (\), but it still isn't working
#include <HID-Project.h>
#include <HID-Settings.h>

#include <Keypad.h>

#define L_ALT KEY_LEFT_ALT
#define TAB KEY_TAB
#define WIN KEY_LEFT_GUI
#define ENTER KEY_RETURN

const byte FILAS = 4;
const byte COLUMNAS = 4;
//define the cymbols on the buttons of the keypads
char Keys[FILAS][COLUMNAS] = {
  {'1', '2', '3', 'A'},
  {'4', '5', '6', 'B'},
  {'7', '8', '9', 'C'},
  {'*', '0', '#', 'D'}
};

byte pinesFilas[FILAS] = {9, 8, 7, 6};
byte pinesColumnas[COLUMNAS] = {5, 4, 3, 2};

char TECLA;

Keypad teclado = Keypad( makeKeymap(Keys), pinesFilas, pinesColumnas, FILAS, COLUMNAS);

void setup() {
  Serial.begin(9600);
  Keyboard.begin();
}

void loop() {
  TECLA = teclado.getKey();

  if (TECLA) {

    switch (TECLA) {
      case '1':
        Serial.print("Tecla 1 presionada");
        break;
      case '2':
        Serial.print("Tecla 2 presionada");
        break;
      case '3':
        Serial.print("Tecla 3 presionada");
        break;
      case 'A':
        Serial.print("Tecla A presionada");

        
        break;
      case '4':
        Serial.print("Tecla 4 presionada");

        Keyboard.press(WIN);
        Keyboard.write('r');
        Keyboard.release(WIN);
        delay(100);
        Keyboard.print("C:\Program Files (x86)\AIMP\AIMP.exe");   //Here's the problem
        //Keyboard.write(ENTER);
        break;
      case '5':
        Serial.print("Tecla 5 presionada");
        break;
      case '6':
        Serial.print("Tecla 6 presionada");
        break;
      case 'B':
        Serial.print("Tecla B presionada");
        break;
      case '7':
        Serial.print("Tecla 7 presionada");
        break;
      case '8':
        Serial.print("Tecla 8 presionada");
        break;
      case '9':
        Serial.print("Tecla 9 presionada");
        break;
      case 'C':
        Serial.print("Tecla C presionada");
        break;
      case '*':
        Serial.print("Tecla * presionada");
        break;
      case '0':
        Serial.print("Tecla 0 presionada");
        break;
      case '#':
        Serial.print("Tecla # presionada");
        break;
      case 'D':
        Serial.print("Tecla D presionada");
        break;
    }
  }
}


user7508: You have to keep in mind that the Arduino doesn't send characters to the
computer. Instead, it simulates key presses, and the computer has to
translate those into characters, according to some keyboard layout. By
default, the Keyboard library assumes the US keyboard layout.
If you are using another layout, you have to tell the library when
initializing it. E.g.
Keyboard.begin(KeyboardLayout_es_ES);

would work with a Spanish keyboard layout.
C.f. the documentation of Keyboard.begin().
If you are using an unsupported layout, you may need to write your own
layout file and add it to the library. You may then contribute it
upstream so that it becomes part of future versions of the Keyboard
library.
Alternatively, you could switch your layout to US in your OS.
PS: The Keyboard library only supports international keyboard
layouts since version 1.0.3, released on 2021-11-04.

83196: <p>I'm trying to make a macro keyboard, where I can press a single button and it will open programs for me.</p>
<p>I'm trying to type this, for example: &quot;c:\windows&quot;</p>
<p>but it gets typed out like this: cÑ}windows</p>
<p>I tried using double backslash (\), but it still isn't working</p>
<pre><code>#include &lt;HID-Project.h&gt;
#include &lt;HID-Settings.h&gt;

#include &lt;Keypad.h&gt;

#define L_ALT KEY_LEFT_ALT
#define TAB KEY_TAB
#define WIN KEY_LEFT_GUI
#define ENTER KEY_RETURN

const byte FILAS = 4;
const byte COLUMNAS = 4;
//define the cymbols on the buttons of the keypads
char Keys[FILAS][COLUMNAS] = {
  {'1', '2', '3', 'A'},
  {'4', '5', '6', 'B'},
  {'7', '8', '9', 'C'},
  {'*', '0', '#', 'D'}
};

byte pinesFilas[FILAS] = {9, 8, 7, 6};
byte pinesColumnas[COLUMNAS] = {5, 4, 3, 2};

char TECLA;

Keypad teclado = Keypad( makeKeymap(Keys), pinesFilas, pinesColumnas, FILAS, COLUMNAS);

void setup() {
  Serial.begin(9600);
  Keyboard.begin();
}

void loop() {
  TECLA = teclado.getKey();

  if (TECLA) {

    switch (TECLA) {
      case '1':
        Serial.print(&quot;Tecla 1 presionada&quot;);
        break;
      case '2':
        Serial.print(&quot;Tecla 2 presionada&quot;);
        break;
      case '3':
        Serial.print(&quot;Tecla 3 presionada&quot;);
        break;
      case 'A':
        Serial.print(&quot;Tecla A presionada&quot;);

        
        break;
      case '4':
        Serial.print(&quot;Tecla 4 presionada&quot;);

        Keyboard.press(WIN);
        Keyboard.write('r');
        Keyboard.release(WIN);
        delay(100);
        Keyboard.print(&quot;C:\Program Files (x86)\AIMP\AIMP.exe&quot;);   //Here's the problem
        //Keyboard.write(ENTER);
        break;
      case '5':
        Serial.print(&quot;Tecla 5 presionada&quot;);
        break;
      case '6':
        Serial.print(&quot;Tecla 6 presionada&quot;);
        break;
      case 'B':
        Serial.print(&quot;Tecla B presionada&quot;);
        break;
      case '7':
        Serial.print(&quot;Tecla 7 presionada&quot;);
        break;
      case '8':
        Serial.print(&quot;Tecla 8 presionada&quot;);
        break;
      case '9':
        Serial.print(&quot;Tecla 9 presionada&quot;);
        break;
      case 'C':
        Serial.print(&quot;Tecla C presionada&quot;);
        break;
      case '*':
        Serial.print(&quot;Tecla * presionada&quot;);
        break;
      case '0':
        Serial.print(&quot;Tecla 0 presionada&quot;);
        break;
      case '#':
        Serial.print(&quot;Tecla # presionada&quot;);
        break;
      case 'D':
        Serial.print(&quot;Tecla D presionada&quot;);
        break;
    }
  }
}
</code></pre>
 7508: <p>You have to keep in mind that the Arduino doesn't send characters to the
computer. Instead, it simulates key presses, and the computer has to
translate those into characters, according to some keyboard layout. By
default, the Keyboard library assumes the US keyboard layout.</p>
<p>If you are using another layout, you have to tell the library when
initializing it. E.g.</p>
<pre class="lang-cpp prettyprint-override"><code>Keyboard.begin(KeyboardLayout_es_ES);
</code></pre>
<p>would work with a Spanish keyboard layout.</p>
<p>C.f. the <a href="https://www.arduino.cc/reference/en/language/functions/usb/keyboard/keyboardbegin/" rel="nofollow noreferrer">documentation of <code>Keyboard.begin()</code></a>.</p>
<p>If you are using an unsupported layout, you may need to write your own
layout file and add it to the library. You may then contribute it
upstream so that it becomes part of future versions of the Keyboard
library.</p>
<p>Alternatively, you could switch your layout to US in your OS.</p>
<p><strong>PS</strong>: The Keyboard library only supports international keyboard
layouts since version 1.0.3, released on 2021-11-04.</p>
