Keyboard.h function does not compile anymore

Hello Guy’s,

Some time ago I’ve written a program which included the Keyboard Library, entering characters onto my screen as if it was a keyboard.
This worked fine but the main program needed some revisions which took some time and therefore the project was put aside for a while.
Recently I picked up that project and I rewrote a huge part of the code as a new project while implementing the Keyboard function, for that part worked nicely. :slight_smile:

But as soon as I implemented that small piece of code, the compiler gave an error telling me the #include <Keyboard.h> was not fitted in the code. Which was most certainly there!
I deleted this line of code and selected the keyboard library again. (which only gave back the exact line of code)
This had no success at all. I upgraded to 1.8.13 without any result.
Even the keyboard.h example code did not work.
I adjusted the type of board to Nano, which I had not done so far in this “new” project, but still no luck.
Even the old code, which I still had, gave that same error trying to compile it.

What is it, I’m missing here? :frowning:
The only difference is that I have no Arduino attached yet. But I cannot see that as a problem while compiling.

The weird thing is that in the test code, a remark is mentioned that <keyboard.h> is only supported for a very small number of boards. While I had the Nano working fine with that function.
Hence, I choose the Nano, especially for that keyboard option. :confused:

Anyone on this??
Rgrds… FTMZ

What is it, I’m missing here?

Details.

the compiler gave an error telling me the #include <Keyboard.h> was not fitted in the code.

I have never, ever seen any such error message.
Quit paraphrasing.

(deleted)

First… The error message doe say the following:

exit status 1
'Keyboard' niet gevonden. Heeft uw schets de regel '#include <Keyboard.h>'?

I checked after my original startpost and the NANO is the same as the Micro. Except for the USB connector.

Besides… It did work on a nano Previously.

Below one of the codes I tested…

/*
  Keyboard test

  For the Arduino Leonardo, Micro or Due

  Reads a byte from the serial port, sends a keystroke back.
  The sent keystroke is one higher than what's received, e.g. if you send a,
  you get b, send A you get B, and so forth.

  The circuit:
  - none

  created 21 Oct 2011
  modified 27 Mar 2012
  by Tom Igoe

  This example code is in the public domain.

  http://www.arduino.cc/en/Tutorial/KeyboardSerial
*/

#include "Keyboard.h"

void setup() {
  // open the serial port:
  Serial.begin(9600);
  // initialize control over the keyboard:
  Keyboard.begin();
}

void loop() {
  // check for incoming serial data:
  if (Serial.available() > 0) {
    // read incoming serial data:
    char inChar = Serial.read();
    // Type the next ASCII value from what you received:
    Keyboard.write(inChar + 1);
  }
}

(deleted)

the NANO is the same as the Micro.

Nope.

Keyboard test

  For the Arduino Leonardo, Micro or Due

Can someone explain to me why my project worked earlier on a Nano?
And Exact that code is no longer compilable?

I had a working concept on a Nano.
I'm not a skilled programmer and I'll have to look into other conversations I had about this project, some time ago.

[edit]
Gottit!!
It seems I already created the previous in ProMicro, instead of Nano :confused:
I referred to an old topic of mine in which I had some issues with the Keyboard.
There I found out all was written for ProMicro after all...
https://forum.arduino.cc/?topic=601253#msg4082395

The thing I do not understand though, is how my old program/code seemed to be written for the Nano?
Does the code include the type of board for what it was written?
I guess I selected Nano for some reason, and the compiler also uses that type of board when selecting another, previous project. Maybe?

Anyway, I'm on track again.
Tx for all your efforts! :slight_smile: :slight_smile:

(deleted)

spycatcher2k:
The only board I see you use in past posts is the Leonardo, This works with the Keyboard library. All I can suggest is that your memory is a bit foggy (like mine).

It's an Age thing I guess... :slight_smile:
You were not far off. It was an older project. Using the ProMicro. (I edited my previous post)

Then that final question...
Is there a difference between the Micro and the ProMicro?