Hello, I'm not much of a programmer and I'm having problems with a project where I plan to control some things by Arduino UNO reading midi and controlling servos (music to mechatronics). If I include <Servo.h> in my project, midi stops working (servo test procedures do work as expected). There's no compiler error, just midi messages like NoteON event don't come thru (just by including servo header and nothing more).
I'm bypassing the midi library (GitHub - FortySevenEffects/arduino_midi_library: MIDI for Arduino) with reading and analyzing serial bytes, but I find that rather tedious. Is there any chance someone experienced could compare the two libraries and identify the culprit?
Cheers!
This is a minimal example where it fails (comment out the servo include and it works):
#include <MIDI.h>
#include <Servo.h>
MIDI_CREATE_DEFAULT_INSTANCE();
#define LED 13
void BlinkLed(byte num) {
for (byte i = 0; i < num; i++) {
digitalWrite(LED, HIGH);
delay(150);
digitalWrite(LED, LOW);
delay(150);
}
}
void handleNoteOn(byte channel, byte pitch, byte velocity) {
BlinkLed(pitch);
}
void setup() {
pinMode(LED, OUTPUT);
MIDI.begin(MIDI_CHANNEL_OMNI);
MIDI.setHandleNoteOn(handleNoteOn);
}
void loop() {
MIDI.read();
}