Is this close to what you want?
MIDI-Chord-Buttons.ino: --- |
---|
``` #include "MIDIButtonChord.hpp" |
#include "Notes.hpp" |
constexpr uint8_t channel = 1; // MIDI channel to send on
MIDIButtonChord buttons[] = {
{Chords::Major, 2, note(C, 4), channel}, // Major C chord in the 4th octave, button between pin 2 and ground, MIDI channel 1
{Chords::Minor, 3, note(D, 4), channel},
{Chords::Minor, 4, note(E, 4), channel},
{Chords::MajorFirstInv, 5, note(F, 4), channel},
{Chords::MajorSecondInv, 6, note(G, 4), channel},
{Chords::MinorSecondInv, 7, note(A, 4), channel},
{Chords::Diminished, 8, note(B, 4), channel},
};
/*
* You can change the chords afterwards using
* buttons[0].setChord(Chords::MajorSeventh);
* for example.
*/
void setupcolor=#000000[/color] {
MIDI.begincolor=#000000[/color];
for (MIDIButtonChord &button : buttons)
button.begincolor=#000000[/color];
}
void loopcolor=#000000[/color] {
for (MIDIButtonChord &button : buttons)
button.updatecolor=#000000[/color];
}
```
|
Full code attached.
Pieter
MIDI-Chord-Buttons.zip (5.27 KB)