Hi there,
I've decided to make my own MIDI controller for the Virtual DJ program. For this I first bought the Arduino Pro Mico and wrote a test program. I tested it with FL Studio and after a few problems that I was able to solve, it worked perfectly. I immediately opened Virtual DJ to test it there, but every time I connect the Arduino Pro Mico it just goes white and dosn't respond anymore until I unplug the arduino again.
I've already tried:
- Use another pro micro
- Testing on my laptop => same error
- Rewrite the program
I also tried to load a completely different program on it and then it didn't crash. I think every time I use the "MIDIUSB.h" library, this error occurs.
Here is the code I'm currently trying to get to work:
#include "MIDIUSB.h"
const int FADER = 9; // Pitch Fader pin
int analogval = 0;
byte midiCh = 0x01;
byte cc = 0x01;
void noteOn(byte channel, byte pitch, byte velocity) {
midiEventPacket_t noteOn = {0x09, 0x90 | channel, pitch, velocity};
MidiUSB.sendMIDI(noteOn);
}
void noteOff(byte channel, byte pitch, byte velocity) {
midiEventPacket_t noteOff = {0x08, 0x80 | channel, pitch, velocity};
MidiUSB.sendMIDI(noteOff);
}
void setup() {
//Serial.begin(9200);
}
void controlChange(byte channel, byte control, byte value) {
midiEventPacket_t event = {0x0B, 0xB0 | channel, control, value};
MidiUSB.sendMIDI(event);
}
void loop() {
int analogval = analogRead(FADER);
controlChange(midiCh, cc, map(analogval, 0, 1023, 0, 127)); // Channel 6, Control Change 016, Fader value
MidiUSB.flush();
delay(150);
}
I also get this warning every time I upload the sketch:
Can someone help me? Thanks in advance.