You have used the wrong syntax for the Keyboard functions. For instance
Keyboard.begin;
should be
Keyboard.begin();
also, the press() function simulates the pressing of a key rather than reading whether a key is pressed and, anyway, in C, == is used for comparison of values rather than =
Then the Keyboard library will not work (wrong processor) , nor do you need it
To determine whether a key has been pressed you can do something like this
void setup()
{
Serial.begin(115200);
}
void loop()
{
if (Serial.available()) //if a character is available to read
{
char inChar = Serial.read(); //read the character
if (inChar == 'n') //test the character
{
Serial.println("you pressed n");
}
}
}
Hello
I´m using this small sketch to set values into a sketch during testing.
void checkKeyboard() {
if (Serial.available()) {
switch (Serial.read()) {
case '1': break;
case '2': break;
case '3': break;
case '4': break;
case '5': break;
case '6': break;
}
}
}
Have a nice day and enjoy programming in C++ and learning.
Дайте миру шанс!