user35430: I'm trying to run the MIDI example from Arduino.CC in Arduino Studio.
I am using an Arduino Leonardo, which has USB HID capabilities. I have installed the library as mentioned:

When I press the compile or upload button, it says:
'D3' was not declared in this scope

What's wrong? How do I fix this?

user35430: The pitches for the notes are taken from pitchToNote.h. In there you can see definitions for the notes like:
#define pitchC3  48

It seems that the names were changed from C3 to pitchC3.
I am not 100% sure, but my guess is that this was done to avoid conflicts between the note A3 and the analog input A3 (and silimar).
So, in line 25 of the example code, add pitch for all notes:
const byte notePitches[NUM_BUTTONS] = {pitchC3, pitchD3, pitchE3, pitchF3, pitchG3, pitchA3, pitchB3};


35430: <p>I'm trying to run the <a href="https://www.arduino.cc/en/Tutorial/MidiDevice" rel="nofollow noreferrer">MIDI example from Arduino.CC</a> in Arduino Studio.</p>

<p>I am using an Arduino Leonardo, which has USB HID capabilities. I have installed the library as mentioned:</p>

<p><a href="https://i.stack.imgur.com/tIr6P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tIr6P.png" alt="MIDI Library installed"></a></p>

<p>When I press the compile or upload button, it says:</p>

<pre><code>'D3' was not declared in this scope
</code></pre>

<p>What's wrong? How do I fix this?</p>
 35430: <p>The pitches for the notes are taken from <a href="https://github.com/arduino-libraries/MIDIUSB/blob/master/src/pitchToNote.h" rel="nofollow noreferrer">pitchToNote.h</a>. In there you can see definitions for the notes like:</p>

<pre><code>#define pitchC3  48
</code></pre>

<p>It seems that the names were changed from <code>C3</code> to <code>pitchC3</code>.</p>

<p>I am not 100% sure, but my guess is that this was done to avoid conflicts between the note <code>A3</code> and the analog input <code>A3</code> (and silimar).</p>

<p>So, in line 25 of the example code, add <code>pitch</code> for all notes:</p>

<pre><code>const byte notePitches[NUM_BUTTONS] = {pitchC3, pitchD3, pitchE3, pitchF3, pitchG3, pitchA3, pitchB3};
</code></pre>
