Arduino Nano 33 IoT not showing in MIDI Devices
Nauthizful opened this issue · 0 comments
Nauthizful commented
Hello, I just bought an Arduino Nano 33 IoT and uploaded code that I was using with a Mega and Hairless (was working with the mega)
Now that I have a Nano 33 IoT I want to use "USBMIDI_Interface" so I don't have to use Hairless and Loop MIDI. But the device is not showing neither in FL Studio or TH-U Overloud.
I installed MIDIUSB. If you have any tips to improve my code, I'll take it but for now I just want to be able to use my arduino as midi device, I'll optimize code later !
Thx for your help
Here is my code :
#include <Control_Surface.h>
const int COULEURS[8][3] = {
{ 0, 255, 255 }, //Rouge 0
{ 0, 0, 255 }, //Jaune 1
{ 255, 0, 255 }, //Vert 2
{ 255, 0, 0 }, //Cyan 3
{ 255, 255, 0 }, //Bleu 4
{ 0, 255, 0 }, //Magenta 5
{ 0, 0, 0 }, //Blanc 6
{ 255, 255, 255 }, //Éteint 7
};
//Déclaration des constantes des boutons
const int BUTTON1 = 2;
const int BUTTON2 = 3;
const int BUTTON3 = 4;
const int BUTTON4 = 5;
const int BUTTON5 = 6;
const int BUTTON6 = 7;
const int BUTTON7 = 8;
const int BUTTON8 = 9;
const int BUTTON9 = 10;
const int BUTTON10 = 11;
const int DUMMY_BUTTON = 53;
//Déclaration des constantes des pédales d'expression
const int EXP1 = A0;
const int EXP2 = A1;
//Déclaration des constantes des LEDS
const int LEDR = A3;
const int LEDB = A4;
const int LEDV = A5;
//Initialisation de l'interface midi
USBMIDI_Interface midi;
//Initialisation de la Bank (3 banks avec 9 bouttons dans chaque)
Bank<3> bank{ 9 };
//Initialisation
IncrementDecrementSelector<3> selector{
bank,
{ BUTTON10, DUMMY_BUTTON },
Wrap::Wrap,
};
Bankable::CCButton button1{
{ bank, BankType::CHANGE_ADDRESS },
BUTTON1,
{ BUTTON1, CHANNEL_1 },
};
Bankable::CCButton button2{
{ bank, BankType::CHANGE_ADDRESS },
BUTTON2,
{ BUTTON2, CHANNEL_1 },
};
Bankable::CCButton button3{
{ bank, BankType::CHANGE_ADDRESS },
BUTTON3,
{ BUTTON3, CHANNEL_1 },
};
Bankable::CCButton button4{
{ bank, BankType::CHANGE_ADDRESS },
BUTTON4,
{ BUTTON4, CHANNEL_1 },
};
Bankable::CCButton button5{
{ bank, BankType::CHANGE_ADDRESS },
BUTTON5,
{ BUTTON5, CHANNEL_1 },
};
Bankable::CCButton button6{
{ bank, BankType::CHANGE_ADDRESS },
BUTTON6,
{ BUTTON6, CHANNEL_1 },
};
Bankable::CCButton button7{
{ bank, BankType::CHANGE_ADDRESS },
BUTTON7,
{ BUTTON7, CHANNEL_1 },
};
Bankable::CCButton button8{
{ bank, BankType::CHANGE_ADDRESS },
BUTTON8,
{ BUTTON8, CHANNEL_1 },
};
Bankable::CCButton button9{
{ bank, BankType::CHANGE_ADDRESS },
BUTTON9,
{ BUTTON9, CHANNEL_1 },
};
CCPotentiometer exp1{ EXP1, MIDI_CC::General_Purpose_Controller_1 };
//CCPotentiometer exp2{ EXP2, MIDI_CC::General_Purpose_Controller_2 };
void setup() {
pinMode(LEDR, OUTPUT);
pinMode(LEDB, OUTPUT);
pinMode(LEDV, OUTPUT);
Control_Surface.begin();
}
void loop() {
Control_Surface.loop();
switch (bank.getSelection()) {
case 0:
setColor(COULEURS[0][0], COULEURS[0][1], COULEURS[0][2]);
break;
case 1:
setColor(COULEURS[2][0], COULEURS[2][1], COULEURS[2][2]);
break;
case 2:
setColor(COULEURS[4][0], COULEURS[4][1], COULEURS[4][2]);
break;
default:
setColor(COULEURS[7][0], COULEURS[7][1], COULEURS[7][2]);
break;
}
}
void setColor(int rValue, int vValue, int bValue) {
analogWrite(LEDR, rValue);
analogWrite(LEDV, vValue);
analogWrite(LEDB, bValue);
}