Skip to content

Instantly share code, notes, and snippets.

@YuuichiAkagawa
Last active March 21, 2024 11:58
Show Gist options
  • Save YuuichiAkagawa/4226da674be9fc619b67e6607b797608 to your computer and use it in GitHub Desktop.
Save YuuichiAkagawa/4226da674be9fc619b67e6607b797608 to your computer and use it in GitHub Desktop.
NUX MG-300 CC test
/*
*******************************************************************************
* NUX MG-300 CC test
* Copyright (C) 2021 Yuuichi Akagawa
*
* This is sample program. Just sample.
*******************************************************************************
*/
#include <usbh_midi.h>
#include <usbhub.h>
USB Usb;
//USBHub Hub(&Usb);
USBH_MIDI Midi(&Usb);
void MIDI_poll();
void setup()
{
Serial.begin(115200);
if (Usb.Init() == -1) {
while (1); //halt
}//if (Usb.Init() == -1...
delay( 200 );
}
void loop()
{
Usb.Task();
if( Midi ) {
MIDI_poll();
changePatch(10);
delay(1000);
changePatch(11);
delay(1000);
}
}
// Poll USB MIDI Controler
void MIDI_poll()
{
uint8_t inBuf[ 3 ];
while(Midi.RecvData(inBuf))
;
}
void changePatch(uint8_t npatch)
{
uint8_t buf[3];
buf[0] = 0xb0;
buf[1] = 60;
buf[2] = npatch;
Midi.SendData(buf);
}
@dielbi
Copy link

dielbi commented Dec 9, 2022

Hi Yuuichi, i found you to be knowledgeable in coding based on my github search. I am a newbie, not even a coder so I got interested in making my DIY midi controller for MG300 (i thought to play around with existing codes but failed to find one). I have been struggling to find online for arduino code for many weeks, your test code is the only code that was able to communicate with MG300... it automatically makes looping patch change. I am using UNO + USB Host Shield on my project with 4 buttons and LEDS hoping I can assign a specific patch number to each button. Can you please help me even with just couple of working buttons based on your sample code? thanks

@YuuichiAkagawa
Copy link
Author

We do not provide free support for individual projects.
You may find this issue helpful for what you are trying to achieve.

@dielbi
Copy link

dielbi commented Dec 11, 2022

Okay got it. Thanks for the link provided

@Satnamtaro
Copy link

Hello.
I hope you can help me since I am really not sure how to approach it properly.

I purchased the NUX MG300 and a MIDI switching device called Melo Midi Commander, together with Bluetooth MID send/receive devices called MS1.

From what I see on this page, I need to send the texts written by Mr. Yuiixhi to MG300, but how do I do that?
I am not very experienced in this data-transmitting endeavor between PCs and devices, so it would be great if you could point me in the right direction.

I will be waiting for your reply.
m(..)m

Satnamtaro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment