Arduino Keyboard Library Problem

I have been looking at making some custom controllers for my PC and wanted to use the built in Keyboard and Mouse library to do it. The problem though is I keep getting the same error message when I start using the code:

error: 'Keyboard' not found. Does your sketch include the line '#include <Keyboard.h>'?

I don't think my code is the issue;

#include <Keyboard.h>                  //Adding the keyboard library

int shaker = 7;                        //Declaring the pin for the vibration sensor

void setup() 
{
  pinMode(shaker, INPUT);              //Declaring the senor pin
  Keyboard.begin();                    //intializing control over keyboard
}

void loop() 
{
  int val = digitalRead(shaker);       //Collecting sensor stat, works as a button

  if(val == HIGH)                      //Test sensor stat
  {
    Keyboard.press('w');               //pressing keyboard key 'w'
    Keyboard.releaseAll();             //inputing the pressed key
  }
}

I tried re downloading the keyboard library but then I just got another error that said there were multiply versions of that library. I have seen other people have had this issue but the only other post I found on the topic on the forum did not have a solution.

Any help would be greatly appreciated.

Reply #2 in the thread that you linked probably contains the answer :wink:

sterretje:
Reply #2 in the thread that you linked probably contains the answer :wink:

Ah your right, I thought I heard all the libraries in the Arduino IDE work with the Arduino Uno. Apparently after doing some more digging you need a board based off of 32u4 or SAMD (Leonardo, Esplora, Zero, Due and MKR Family). Thanks for your help.