Hi all, I am building a midi controller for my guitar effect, I used a Arduino Uno to connect 6 button to send midi signal to the effector.
And I wrote a program and it works after I upload it to the Arduino Uno, but after I disconnect the power and turn it on again, I find that the program does not function, how can I solve it, plz help
Here is the code:
#include<MIDI.h>
MIDI_CREATE_DEFAULT_INSTANCE();
void setup() {
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(6, INPUT_PULLUP);
pinMode(7, INPUT_PULLUP);
MIDI.begin(MIDI_CHANNEL_OMNI);
}
void loop() {
if (digitalRead(2) == LOW) {
MIDI.sendProgramChange(120, 1);
delay(200);
}
if (digitalRead(3) == LOW) {
MIDI.sendProgramChange(121, 1);
delay(200);
;
}
if (digitalRead(4) == LOW) {
MIDI.sendProgramChange(122, 1);
delay(200);
}
if (digitalRead(5) == LOW) {
MIDI.sendProgramChange(123, 1);
delay(200);
}
if (digitalRead(6) == LOW) {
MIDI.sendProgramChange(124, 1);
delay(200);
}
if (digitalRead(7) == LOW) {
MIDI.sendProgramChange(125, 1);
delay(200);
}
}