Hola

ola encontré un código en internet para que las teclas wasd sean remplazadas por un joy stick pero al subir el código me marca: Keyboard no encontrado.Tu sketch incluye la linea #include <keyboard.h>´?
Les adjunto el código:
int currStateY1;
int prevStateY1;
int currStateY2;
int prevStateY2;
int currStateX1;
int prevStateX1;
int currStateX2;
int prevStateX2;

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

void loop()
{
int sensorValueY = analogRead(A11);
int sensorValueX = analogRead(A10);

{ // Y+
currStateY1 = sensorValueY > 404;
if (currStateY1 != prevStateY1)
{
if (currStateY1 == (sensorValueY < 50))
{
Keyboard.press(KEY_W);
}
else
{
Keyboard.release(KEY_W);
}
}
prevStateY1 = currStateY1;
}

{ //Y-
currStateY2 = sensorValueY < 594;
if (currStateY2 != prevStateY2)
{
if (currStateY2 == (sensorValueY > 973))
{
Keyboard.press(KEY_S);
}
else
{
Keyboard.release(KEY_S);
}
}
prevStateY2 = currStateY2;
}

{ //X
currStateX1 = sensorValueX > 408;
if (currStateX1 != prevStateX1)
{
if (currStateX1 == (sensorValueX < 50))
{
Keyboard.press(KEY_A);
}
else
{
Keyboard.release(KEY_A);
}
}
prevStateX1 = currStateX1;
}

{ //X-
currStateX2 = sensorValueX < 598;
if (currStateX2 != prevStateX2)
{
if (currStateX2 == (sensorValueX > 973))
{
Keyboard.press(KEY_D);
}
else
{
Keyboard.release(KEY_D);
}
}
prevStateX2 = currStateX2;
}
}

Ya logre resolverlo pero ahora aparece que KEY_W,KEY_A,KEY_S,KEY_D was not declared in this scope.
Porfavor ayudenme

Moderador
Por favor edita tu post usando etiquetas de código.

Lee las Normas del foro