Makey Makey Source Code Troubles

Hi. I am working on doing an Makey Makey demo for some elementary kids next week but I am having some troubles with the source code. I wanted to change the key output but when I compiled the unedited source code it gave me these errors:

The .ino file and the settings.h file are in the same folder. I have been searching all over this forum and other sites for solutions but I couldn't find anything and need to have this figured out by Friday. Thank you for your help.

I can only post once every 5 minutes and there is a limit on how many words per post so stay tuned for the rest of the code.

Errors:

Arduino: 1.6.13 (Windows 10), Board: "Arduino/Genuino Uno"

In file included from C:\Users\MAX\Downloads\MaKeyMaKey-master\firmware\Arduino\makey_makey\makey_makey.ino:49:0:

C:\Program Files (x86)\Arduino\libraries\Keyboard\src/Keyboard.h:29:2: warning: #warning "Using legacy HID core (non pluggable)" [-Wcpp]

 #warning "Using legacy HID core (non pluggable)"

  ^

In file included from C:\Users\MAX\Downloads\MaKeyMaKey-master\firmware\Arduino\makey_makey\makey_makey.ino:50:0:

C:\Program Files (x86)\Arduino\libraries\Mouse\src/Mouse.h:29:2: warning: #warning "Using legacy HID core (non pluggable)" [-Wcpp]

 #warning "Using legacy HID core (non pluggable)"

  ^

In file included from C:\Users\MAX\Downloads\MaKeyMaKey-master\firmware\Arduino\makey_makey\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

   ^

C:\Users\MAX\Downloads\MaKeyMaKey-master\firmware\Arduino\makey_makey\makey_makey.ino: In function 'void initializeArduino()':

makey_makey:184: error: 'Keyboard' not found. Does your sketch include the line '#include <Keyboard.h>'?
   Keyboard.begin();

   ^

makey_makey:185: error: 'Mouse' not found. Does your sketch include the line '#include <Mouse.h>'?
   Mouse.begin();

   ^

C:\Users\MAX\Downloads\MaKeyMaKey-master\firmware\Arduino\makey_makey\makey_makey.ino: In function 'void initializeInputs()':

makey_makey:229: error: 'MOUSE_LEFT' was not declared in this scope

     else if ((inputs[i].keyCode == MOUSE_LEFT) || (inputs[i].keyCode == MOUSE_RIGHT)) {

                                    ^

makey_makey:229: error: 'MOUSE_RIGHT' was not declared in this scope

     else if ((inputs[i].keyCode == MOUSE_LEFT) || (inputs[i].keyCode == MOUSE_RIGHT)) {

                                                                         ^

C:\Users\MAX\Downloads\MaKeyMaKey-master\firmware\Arduino\makey_makey\makey_makey.ino: In function 'void updateInputStates()':

makey_makey:319: error: 'Keyboard' not found. Does your sketch include the line '#include <Keyboard.h>'?
           Keyboard.release(inputs[i].keyCode);

           ^

makey_makey:334: error: 'Keyboard' not found. Does your sketch include the line '#include <Keyboard.h>'?
           Keyboard.press(inputs[i].keyCode);

           ^

C:\Users\MAX\Downloads\MaKeyMaKey-master\firmware\Arduino\makey_makey\makey_makey.ino: In function 'void sendMouseButtonEvents()':

makey_makey:394: error: 'MOUSE_LEFT' was not declared in this scope

           if (inputs[i].keyCode == MOUSE_LEFT) {

                                    ^

makey_makey:395: error: 'Mouse' not found. Does your sketch include the line '#include <Mouse.h>'?
             Mouse.press(MOUSE_LEFT);

             ^

makey_makey:397: error: 'MOUSE_RIGHT' was not declared in this scope

           if (inputs[i].keyCode == MOUSE_RIGHT) {

                                    ^

makey_makey:398: error: 'Mouse' not found. Does your sketch include the line '#include <Mouse.h>'?
             Mouse.press(MOUSE_RIGHT);

             ^

makey_makey:402: error: 'MOUSE_LEFT' was not declared in this scope

           if (inputs[i].keyCode == MOUSE_LEFT) {

                                    ^

makey_makey:403: error: 'Mouse' not found. Does your sketch include the line '#include <Mouse.h>'?
             Mouse.release(MOUSE_LEFT);

             ^

makey_makey:405: error: 'MOUSE_RIGHT' was not declared in this scope

           if (inputs[i].keyCode == MOUSE_RIGHT) {

                                    ^

makey_makey:406: error: 'Mouse' not found. Does your sketch include the line '#include <Mouse.h>'?
             Mouse.release(MOUSE_RIGHT);

             ^

C:\Users\MAX\Downloads\MaKeyMaKey-master\firmware\Arduino\makey_makey\makey_makey.ino: In function 'void sendMouseMovementEvents()':

makey_makey:493: error: 'Mouse' not found. Does your sketch include the line '#include <Mouse.h>'?
       Mouse.move(horizmotion * PIXELS_PER_MOUSE_STEP, vertmotion * PIXELS_PER_MOUSE_STEP);

       ^

C:\Users\MAX\Downloads\MaKeyMaKey-master\firmware\Arduino\makey_makey\makey_makey.ino: In function 'void updateOutLEDs()':

makey_makey:688: error: 'TXLED1' was not declared in this scope

     TXLED1;

     ^

makey_makey:693: error: 'TXLED0' was not declared in this scope

     TXLED0;

     ^

makey_makey:699: error: 'RXLED1' was not declared in this scope

     RXLED1;

     ^

makey_makey:704: error: 'RXLED0' was not declared in this scope

     RXLED0;

     ^

exit status 1
'KEY_UP_ARROW' was not declared in this scope

Settings.h:

#include "Arduino.h"

/*
/////////////////////////////////////////////////////////////////////////
// KEY MAPPINGS: WHICH KEY MAPS TO WHICH PIN ON THE MAKEY MAKEY BOARD? //
/////////////////////////////////////////////////////////////////////////
  
  - edit the keyCodes array below to change the keys sent by the MaKey MaKey for each input
  - the comments tell you which input sends that key (for example, by default 'w' is sent by pin D5)
  - change the keys by replacing them. for example, you can replace 'w' with any other individual letter,
    number, or symbol on your keyboard
  - you can also use codes for other keys such as modifier and function keys (see the
    the list of additional key codes at the bottom of this file)

*/

int keyCodes[NUM_INPUTS] = {
  // top side of the makey makey board
 
  KEY_UP_ARROW,      // up arrow pad
  KEY_DOWN_ARROW,    // down arrow pad
  KEY_LEFT_ARROW,    // left arrow pad
  KEY_RIGHT_ARROW,   // right arrow pad
  ' ',               // space button pad
  MOUSE_LEFT,        // click button pad
  
  // female header on the back left side
  
  'w',                // pin D5
  'a',                // pin D4
  's',                // pin D3
  'd',                // pin D2
  'f',                // pin D1
  'g',                // pin D0
  
  // female header on the back right side
  
  MOUSE_MOVE_UP,      // pin A5
  MOUSE_MOVE_DOWN,    // pin A4
  MOUSE_MOVE_LEFT,    // pin A3
  MOUSE_MOVE_RIGHT,   // pin A2
  MOUSE_LEFT,         // pin A1
  MOUSE_RIGHT         // pin A0
};

///////////////////////////
// NOISE CANCELLATION /////
///////////////////////////
#define SWITCH_THRESHOLD_OFFSET_PERC  5    // number between 1 and 49
                                           // larger value protects better against noise oscillations, but makes it harder to press and release
                                           // recommended values are between 2 and 20
                                           // default value is 5

#define SWITCH_THRESHOLD_CENTER_BIAS 55   // number between 1 and 99
                                          // larger value makes it easier to "release" keys, but harder to "press"
                                          // smaller value makes it easier to "press" keys, but harder to "release"
                                          // recommended values are between 30 and 70
                                          // 50 is "middle" 2.5 volt center
                                          // default value is 55
                                          // 100 = 5V (never use this high)
                                          // 0 = 0 V (never use this low
                                          

/////////////////////////
// MOUSE MOTION /////////
/////////////////////////
#define MOUSE_MOTION_UPDATE_INTERVAL  35   // how many loops to wait between 
                                           // sending mouse motion updates
                                           
#define PIXELS_PER_MOUSE_STEP         4     // a larger number will make the mouse
                                           // move faster

#define MOUSE_RAMP_SCALE              150  // Scaling factor for mouse movement ramping
                                           // Lower = more sensitive mouse movement
                                           // Higher = slower ramping of speed
                                           // 0 = Ramping off
                                            
#define MOUSE_MAX_PIXELS              10   // Max pixels per step for mouse movement

/*

///////////////////////////
// ADDITIONAL KEY CODES ///
///////////////////////////

- you can use these codes in the keyCodes array above
- to get modifier keys, function keys, etc 

KEY_LEFT_CTRL
KEY_LEFT_SHIFT		
KEY_LEFT_ALT		
KEY_LEFT_GUI		
KEY_RIGHT_CTRL		
KEY_RIGHT_SHIFT		
KEY_RIGHT_ALT	
KEY_RIGHT_GUI		

KEY_BACKSPACE		
KEY_TAB				
KEY_RETURN			
KEY_ESC				
KEY_INSERT			
KEY_DELETE			
KEY_PAGE_UP			
KEY_PAGE_DOWN		
KEY_HOME
KEY_END				
KEY_CAPS_LOCK	
	
KEY_F1				
KEY_F2				
KEY_F3				
KEY_F4				
KEY_F5				
KEY_F6				
KEY_F7				
KEY_F8				
KEY_F9				
KEY_F10
KEY_F11				
KEY_F12			

*/

Makey Makey Source Code:
http://pastie.org/10973651

  KEY_UP_ARROW,      // up arrow pad

That is line 20. Where IS the KEY_UP_ARROW variable/constant, whose value you are trying to use, defined?

Post ALL of your code. Use Reply (not the Quick Reply field), and the Additional Options link, to attach the files, if needed.

Currently I am not trying to do anything. That is just the unedited source code for the MakeyMakey that is available through the GitHub link. GitHub - sparkfun/MaKeyMaKey: The main branch for MaKey MaKey firmware on SparkFun's version of the board.

makey_makey.ino (17 KB)

settings.h (4.07 KB)

What version of the IDE are you using? The code you posted expects version 1.6.5 or higher.

PaulS:
What version of the IDE are you using? The code you posted expects version 1.6.5 or higher.

1.6.13

OK. Now, which Arduino? Only some Arduinos can use the Keyboard and Mouse libraries.

I believe he said he is programming a makey makey which is a 32u4 IIRC. It's the same as whatever is on the leonardo.

Delta_G:
I believe he said he is programming a makey makey which is a 32u4 IIRC. It's the same as whatever is on the leonardo.

Yep.

You need to install the SparkFun board definitions:

Thank you so much. I don't know how I missed that haha.