Problem with <keyboard.h> in Arduino 1.7.9. Using Arduino Leonardo

i am using the latest arduino software arduino 1.7.9, but i cant seem to compile a keyboard.h file. they are giving me this error.

Arduino: 1.7.9 (Windows 8.1), Board: "Arduino Leonardo"

Keyboard_input.ino:1:22: fatal error: Keyboard.h: No such file or directory

compilation terminated.

Error compiling.

Was trying to create a flex sensor glove to operate a normal racing game in the PC. I tried to test the coding by using a simple code that i found in the internet. but the error is stopping me from proceeding. Can i get a guidance here? thank you. these are my code:

#include <Keyboard.h>

 const int flexPin1 = A0;

  const int threshold1 = 712;

//Boolean used to initiate glove typing

boolean flexread = false;

void setup() {
  
  //Analogue Setup:
  
  pinMode(flexPin1,INPUT);
  
}

void loop() {
  
  //obtain flex values
  int flex1 = analogRead(flexPin1);

  if (flexread == true){
  //if thumb 
    while (flex1 > threshold1){
      //Send an ASCII '0', 
      delay(300);
      int flex1t = analogRead(flexPin1);
      if (flex1t < flex1);{
        Keyboard.write('9');
        break;
      }


}
  }
  
  else {
    
    delay(20);
  }
}

if there is any problem with the coding, please let me know. thankyou. i cant find the right coding to input the bend of the flex sensor into a keyboard button press.

AzrilAzraei:

#include <Keyboard.h>

1.7.9 is the arduino.org IDE which I have no experience but including keyboard.h is a fairly new change in the arduino.cc IDE(1.6.6 and later) and I know the .org IDE is more closely related to older .cc versions, despite the version number so give it a try without the #include <keyboard.h> line.

If you don't have a specific need to use the .org IDE I would recommend you to switch to the .cc IDE as the people on this forum are much more familiar with that program and so you will have more luck with getting help here.