I am attempting to use certain buttons, joysticks, etc with an arduino so that they are each coded to a specific key on the keyboard using the Keyboard.write function. It is important to note that I am not using an actual keyboard. I want to run an emulator off of it. I have everything plugged in correctly but when I go to run the program, an error message shows up and the program does not upload and run. The message goes:
'Keyboard' not found. Does your sketch include the line '#include <Keyboard.h>'?
I included the library and it still doesn't work. The board I am using is the Elegoo Arduino UNO R3. My line of code is the following:
#include <Keyboard.h>
const int SW_pin = 2;
const int X_pin = A0;
const int Y_pin = A1;
I am only using an input for pushing my joystick left for testing but that's not the issue. For whatever reason, the Keyboard.write function does not work even though I have the library installed and included. What should I do? Any assistance would help.
Keyboard library requires native usb, because it has to be able to tell the microcontroller to appear as a usb hid device, not a serial adapter.
If you want to pretend to be a keyboard, you need to use a board with native usb - leo, micro, due, zero, or one of the other arm boards with native usb.
Keyboard library requires native usb, because it has to be able to tell the microcontroller to appear as a usb hid device, not a serial adapter.
If you want to pretend to be a keyboard, you need to use a board with native usb - leo, micro, due, zero, or one of the other arm boards with native usb.
Does it matter though? I'm not using any sort of usb keyboard, just the function in the code. I am using other input devices connected straight to the board.
Keyboard library requires native usb, because it has to be able to tell the microcontroller to appear as a usb hid device, not a serial adapter.
If you want to pretend to be a keyboard, you need to use a board with native usb - leo, micro, due, zero, or one of the other arm boards with native usb.
Thank you for the help regardless. I thought this might've been the issue but I just wanted to make sure that there wasn't some other way I could do it.
For example, I work on a laptop, does it mean that I will have my keyboard, if connecting another keyboard or panel with keys will block my main keyboard?
I want to select with the mouse, type with my keyboard and play with my keyboard or added panel programmed with arduino in this case as I could
Matthew2510:
For example, I work on a laptop, does it mean that I will have my keyboard, if connecting another keyboard or panel with keys will block my main keyboard?
I want to select with the mouse, type with my keyboard and play with my keyboard or added panel programmed with arduino in this case as I could
They all work together in parallel. Try adding a USB keyboard to your laptop and you will see.