Arduino Micro and a MIDI Controller code

Hello! New to the forums. Nice to meet you.

Recently started an arduino project for my class at school. I decided to go with a MIDI controller as music is something I’m interested in. Following this project (http://www.instructables.com/id/Arcade-Button-MIDI-Controller/?ALLSTEPS), I got everything working with an Uno Rev3. However, after some digging, I learned that I could cut out some of the necessary software if I went with an Arduino Micro.

Bought one today, went to upload the code from the instructables, and I get this sequence of errors:

'PIN_D6' was not declared in this scope
MIDI_Controller.ino: In function 'void setup()':
MIDI_Controller:278: error: 'PIN_D6' was not declared in this scope
MIDI_Controller.ino: In function 'void loop()':
MIDI_Controller:351: error: 'PIN_D6' was not declared in this scope
MIDI_Controller:364: error: 'PIN_D6' was not declared in this scope
MIDI_Controller.ino: In function 'void noteOn(byte, byte, byte)':
MIDI_Controller:479: error: 'usbMIDI' was not declared in this scope
MIDI_Controller.ino: In function 'void noteOff(byte, byte)':
MIDI_Controller:501: error: 'usbMIDI' was not declared in this scope
MIDI_Controller.ino: In function 'void controlChange(byte, byte, byte)':
MIDI_Controller:524: error: 'usbMIDI' was not declared in this scope

The Instructables is more than three years old so I didn’t think I would get any assistance from the author. I was hoping maybe someone here could help me out with the errors I’m getting.

Thank you in advance! Hopefully you can help me understand this a little bit better

edit: I’ve attached the code for simplicities sake

MIDI_Controller.ino (19.2 KB)

#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define ARDUINO_MEGA
#elif defined(__AVR_AT90USB646__)
#define TEENSY_PLUS_PLUS
#elif defined(__AVR_ATmega32U4__)
#define TEENSY_2
#elif defined(__AVR_AT90USB1286__)
#define TEENSY_PLUS_PLUS_2
#else
#define ARDUINO
#endif

Your Micro is being identified as a TEENSY of some sort.

#if defined(TEENSY_PLUS_PLUS) || defined(TEENSY_2) || defined(TEENSY_PLUS_PLUS_2)
  #define LED_PIN PIN_D6
#else
  #define LED_PIN 13
#endif

Since it is a TEENSY, the on-board LED is on the pin defined as PIN_D6.

Since the Micro does not define anything called PIN_D6, the compiler doesn't like:

    if (digitalInputMapping[i] != LED_PIN)

which becomes

    if (digitalInputMapping[i] != PIN_D6)

when the preprocessor runs.

What software are you thinking you can cut out by using a Micro instead?

The project, when focused around an Uno, is using Serial. The serial is converted into a midi signal with a piece of software called Hairless Midi<-> Serial (The Hairless MIDI<->Serial Bridge). I’d read (and I could be wrong) that a Micro has HID capabilities that negate the need for that software.

Yes, but only if the device has "USB midi" or whatever it is called, and then only of you have the right library.

I'd read (and I could be wrong) that a Micro has HID capabilities that negate the need for that software.

Only the Teensy can look like a HID MIDI device. All the others have to use serial and use hairless as a bridge between the serial and the computer's internal MIDI bus.