user50985: I keep getting this error message:
"'Keyboard' not found. Does your sketch include the line '#include <Keyboard.h>'?"

... when I have already included Keyboard.h.
#include <Keyboard.h>

void setup() {
  pinMode(3,INPUT_PULLUP); 
  pinMode(4,INPUT_PULLUP);

 Serial.begin(9600);    //begin seral comms for debugging
}

void loop() {
  Keyboard.begin();
  if (digitalRead(3) == 0) //if button 3 is pushed
   {
Keyboard.write('z');
delay(200);
}
   else if (digitalRead(4) == 0) //if button 3 is pushed
{
  Keyboard.write('x');
  delay(200);
}
  Keyboard.end();
}

Keyboard.h is already included as a default library in Arduino so I'm not sure what's wrong

user6936: If you have Arduino/Genuino Uno selected as your board in the Tools ► Board ► menu, then you get the error. If you select Arduino Leonardo it compiles correctly.
From Can't seem to be able use Keyboard.h library, this post states:

Keyboard.h (and Mouse.h) only works on devices that use the ATmega32u4 processor, like the Leonardo or Micro.  See: https://www.arduino.cc/en/Reference/MouseKeyboard

This solution might help though

I had the same problem using Flora
This worked for me:

Tools > Boards > Boards Manager
Install TeeOnArdu (Then select that board from Boards Manager)
Tools > USB Type > Serial, Keyboard, Mouse < Joypad
Upload and run code again (might need to restart IDE)



50985: <p>I keep getting this error message:</p>

<pre><code>"'Keyboard' not found. Does your sketch include the line '#include &lt;Keyboard.h&gt;'?"
</code></pre>

<p>... when I have already included <code>Keyboard.h</code>.</p>

<pre><code>#include &lt;Keyboard.h&gt;

void setup() {
  pinMode(3,INPUT_PULLUP); 
  pinMode(4,INPUT_PULLUP);

 Serial.begin(9600);    //begin seral comms for debugging
}

void loop() {
  Keyboard.begin();
  if (digitalRead(3) == 0) //if button 3 is pushed
   {
Keyboard.write('z');
delay(200);
}
   else if (digitalRead(4) == 0) //if button 3 is pushed
{
  Keyboard.write('x');
  delay(200);
}
  Keyboard.end();
}
</code></pre>

<p><code>Keyboard.h</code> is already included as a default library in Arduino so I'm not sure what's wrong</p>
 6936: <p>If you have <strong>Arduino/Genuino Uno</strong> selected as your board in the <strong>Tools ► Board ►</strong> menu, then you get the error. If you select <strong>Arduino Leonardo</strong> it compiles correctly.</p>

<p>From <a href="https://forum.arduino.cc/index.php?topic=346139.0" rel="nofollow noreferrer">Can't seem to be able use Keyboard.h library</a>, <a href="https://forum.arduino.cc/index.php?topic=346139.msg2386530#msg2386530" rel="nofollow noreferrer">this post</a> states:</p>

<blockquote>
  <p>Keyboard.h (and Mouse.h) only works on devices that use the ATmega32u4 processor, like the Leonardo or Micro.  See: <a href="https://www.arduino.cc/en/Reference/MouseKeyboard" rel="nofollow noreferrer">https://www.arduino.cc/en/Reference/MouseKeyboard</a></p>
</blockquote>

<p><a href="https://forum.arduino.cc/index.php?topic=346139.msg3671683#msg3671683" rel="nofollow noreferrer">This solution</a> might help though</p>

<blockquote>
  <p>I had the same problem using Flora</p>
  
  <p>This worked for me:</p>
  
  <ol>
  <li>Tools > Boards > Boards Manager</li>
  <li>Install TeeOnArdu (Then select that board from Boards Manager)</li>
  <li>Tools > USB Type > Serial, Keyboard, Mouse &lt; Joypad</li>
  <li>Upload and run code again (might need to restart IDE)</li>
  </ol>
</blockquote>
