Hallo erstmal,
ich möchte das Midi-Shield in einem bestehenden Sketch einbinden.
Da ich absoluter Neuling bin in diesem Gebiet habe ich vom programmieren wenig Ahnung!
Der Sketch von Pieter P. "Midi-chord-Buttons.zip" ist im Anhang.
#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 setup() {
MIDI.begin();
for (MIDIButtonChord &button : buttons)
button.begin();
}
void loop() {
for (MIDIButtonChord &button : buttons)
button.update();
}
Bitte um Hilfe
Nutze ein Sparkfun Midi-shield auf Arduino Mega
Besten Dank schonmal
MIDI-Chord-Buttons.zip (5.27 KB)