0

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:

MIDI Library installed

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?

asked Apr 26, 2020 at 13:16
1
  • the error happens when the source code is being compiled .... the upload is not attempted ... upload only happens when the code compiles without errors Commented Apr 26, 2020 at 18:07

1 Answer 1

1

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};
answered Apr 26, 2020 at 13:16

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.