sparkfun/MaKeyMaKey

issue when uploading the code: <Keyboard.h> and <Mouse.h>, no such file or dictionary

Closed this issue · 4 comments

Hi there, I've done all the steps according to this tutorial: https://learn.sparkfun.com/tutorials/makey-makey-advanced-guide

Though when I upload the code, here's the error log:

Arduino: 1.6.5 (Mac OS X), Board: "SparkFun MaKey MaKey"

makey_makey_1_4_2.ino:48:22: fatal error: Keyboard.h: No such file or directory
compilation terminated.
Error compiling.

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

it doesn't work when remove the #include <Mouse.h> and #include <Keyboard.h>

Thanks in advance!

when removed those two #include, the error log shows:

Arduino: 1.6.5 (Mac OS X), Board: "SparkFun MaKey MaKey"

sorry - this program has been built without plugin support
Error compiling.

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

Hi,

Hmm, it worked fine for me but I only tested it on a Windows 10 OS with Arduino IDE v1.8.3. I do not have a Mac available. Try reinstalling your Arduino IDE v1.6.5 or using a different version [ https://www.arduino.cc/en/Main/OldSoftwareReleases#previous ]. Also, try to reinstall the board definition [ https://github.com/sparkfun/Arduino_Boards/ ].

From the error, I assume that the Arduino IDE is trying to look for the header file but the location of the file is not where it is expecting it to be. You may want to use the library manager: Sketch > Include LIbrary > Manage Libraries... to make sure that the "Keyboard" library is installed.

I tested this on a Mac iOS X and I had issues compiling on Arduino IDE v.1.6.5 but with a different error output:

Arduino: 1.6.5 (Mac OS X), Board: "SparkFun MaKey MaKey"

Build options changed, rebuilding all
In file included from makey_makey.ino:52:0:
settings.h:20: error: 'KEY_UP_ARROW' was not declared in this scope
   KEY_UP_ARROW,      // up arrow pad
   ^
settings.h:21: error: 'KEY_DOWN_ARROW' was not declared in this scope
   KEY_DOWN_ARROW,    // down arrow pad
   ^
settings.h:22: error: 'KEY_LEFT_ARROW' was not declared in this scope
   KEY_LEFT_ARROW,    // left arrow pad
   ^
settings.h:23: error: 'KEY_RIGHT_ARROW' was not declared in this scope
   KEY_RIGHT_ARROW,   // right arrow pad
   ^
settings.h:25: error: 'MOUSE_LEFT' was not declared in this scope
   MOUSE_LEFT,        // click button pad
   ^
settings.h:42: error: 'MOUSE_LEFT' was not declared in this scope
   MOUSE_LEFT,         // pin A1
   ^
settings.h:43: error: 'MOUSE_RIGHT' was not declared in this scope
   MOUSE_RIGHT         // pin A0
   ^
makey_makey.ino: In function 'void initializeArduino()':
makey_makey:184: error: 'Keyboard' only supported on the Arduino Leonardomakey_makey:185: error: 'Mouse' only supported on the Arduino Leonardomakey_makey.ino: In function 'void initializeInputs()':
makey_makey:229: error: 'MOUSE_LEFT' was not declared in this scope
makey_makey:229: error: 'MOUSE_RIGHT' was not declared in this scope
makey_makey.ino: In function 'void updateInputStates()':
makey_makey:319: error: 'Keyboard' only supported on the Arduino Leonardomakey_makey:334: error: 'Keyboard' only supported on the Arduino Leonardomakey_makey.ino: In function 'void sendMouseButtonEvents()':
makey_makey:394: error: 'MOUSE_LEFT' was not declared in this scope
makey_makey:395: error: 'Mouse' only supported on the Arduino Leonardomakey_makey:397: error: 'MOUSE_RIGHT' was not declared in this scope
makey_makey:398: error: 'Mouse' only supported on the Arduino Leonardomakey_makey:402: error: 'MOUSE_LEFT' was not declared in this scope
makey_makey:403: error: 'Mouse' only supported on the Arduino Leonardomakey_makey:405: error: 'MOUSE_RIGHT' was not declared in this scope
makey_makey:406: error: 'Mouse' only supported on the Arduino Leonardomakey_makey.ino: In function 'void sendMouseMovementEvents()':
makey_makey:493: error: 'Mouse' only supported on the Arduino Leonardo'KEY_UP_ARROW' was not declared in this scope

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.

When testing on v1.8+, I had no issues compiling with the latest board definition. This may have something to do with the way the Arduino IDE v1.6.5 paths were setup, the new board add on specifications [ https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification ], or the configuration of the Mac iOS X that I was testing on. Since the ATmega32U4-Based Makey Makey is retired, the best solution would be to update your IDE version, update your board add-on, or try on a different computer.

Since the Makey Makey w/ Atmega32U4 has been retired in SparkFun's catalog, I will be closing this issue. If you have further issues, you may want to check out the following resources if you still have issues compiling: