Midi to USB for Zoom Ms70Cdr


I am trying to control a Zoom Ms 70 CDR from a Midi foot controller via a usb Host Shield.

i have seen it done before using the following Sketch, but at the moment its not working for me i have tried different ide,s but still the same it compiles fine, but wont change programs via midi.
is there something i am missing? the midi in circuit is working fine.
so it would lead me to believe ether the sketch is faulty or the shield is faulty or i have it configured wrong.
The footswitch changes the programs fine on the zoom via midi ox, also i noticed that when i press a switch on the foot controller that the Rx led doesn’t blink.

can anyone help please

 * Legacy Serial MIDI and USB Host bidirectional converter
 * Copyright (C) 2013-2016 Yuuichi Akagawa
 * for use with Arduino MIDI library
 * https://github.com/FortySevenEffects/arduino_midi_library/
 * Note:
 * - If you want use with Leonardo, you must choose Arduino MIDI library v4.0 or higher.
 * - This is sample program. Do not expect perfect behavior.

#include <MIDI.h>
#include <usbh_midi.h>
#include <usbhub.h>

// Satisfy the IDE, which needs to see the include statment in the ino too.
#ifdef dobogusinclude
#include <spi4teensy3.h>
#include <SPI.h>

//Arduino MIDI library v4.2 compatibility
#ifdef USBCON
#define _MIDI_SERIAL_PORT Serial1
#define _MIDI_SERIAL_PORT Serial

// MIDI Pin assign
// 2 : GND
// 4 : +5V(Vcc) with 220ohm
// 5 : TX

USB Usb;
USBH_MIDI Midi(&Usb);

void MIDI_poll();
void doDelay(unsigned long t1, unsigned long t2, unsigned long delayTime);

//If you want handle System Exclusive message, enable this #define otherwise comment out it.

MidiSysEx sysExData;
void handle_sysex( byte* sysexmsg, unsigned sizeofsysex) {
  Midi.SendSysEx(sysexmsg, sizeofsysex);

void setup()
  if (Usb.Init() == -1) {
    while (1); //halt
  }//if (Usb.Init() == -1...
  delay( 200 );

void loop()
  unsigned long t1;
  uint8_t msg[4];

  t1 = micros();
  if ( Usb.getUsbTaskState() == USB_STATE_RUNNING )
    if (MIDI.read()) {
      msg[0] = MIDI.getType();
      switch (msg[0]) {
        case midi::ActiveSensing :
        case midi::SystemExclusive :
          //SysEx is handled by event.
        default :
          msg[1] = MIDI.getData1();
          msg[2] = MIDI.getData2();
          Midi.SendData(msg, 0);
  doDelay(t1, micros(), 1000);

// Poll USB MIDI Controler and send to serial MIDI
void MIDI_poll()
  uint8_t size;
  uint8_t recvBuf[MIDI_EVENT_PACKET_SIZE];
  uint8_t rcode = 0;     //return code
  uint16_t  rcvd;
  uint8_t   readPtr = 0;

  rcode = Midi.RecvData( &rcvd, recvBuf);

  //data check
  if (rcode != 0) return;
  if ( recvBuf[0] == 0 && recvBuf[1] == 0 && recvBuf[2] == 0 && recvBuf[3] == 0 ) {
    return ;

  uint8_t *p = recvBuf;
  while (readPtr < MIDI_EVENT_PACKET_SIZE)  {
    if (*p == 0 && *(p + 1) == 0) break; //data end
    MidiSysEx::Status rc = sysExData.set(p);
    switch (rc) {
      case MidiSysEx::nonsysex :  //No SysEx message send data to Serial MIDI
        size = Midi.lookupMsgSize(*p);
        _MIDI_SERIAL_PORT.write(p, size);
        p += 3;
      case MidiSysEx::done :      //SysEx end. send data to Serial MIDI
        _MIDI_SERIAL_PORT.write(sysExData.get(), sysExData.getSize());
        /* FALLTHROUGH */
      case MidiSysEx::overflow :  //SysEx buffer over. ignore and flush buffer.
        /* FALLTHROUGH */
        p += 4;
    readPtr += 4;
  uint8_t outBuf[ 3 ];
  do {
    if ( (size = Midi.RecvData(outBuf)) > 0 ) {
      //MIDI Output
      _MIDI_SERIAL_PORT.write(outBuf, size);
  } while (size > 0);

// Delay time (max 16383 us)
void doDelay(unsigned long t1, unsigned long t2, unsigned long delayTime)
  unsigned long t3;

  if ( t1 > t2 ) {
    t3 = (0xFFFFFFFF - t1 + t2);
  } else {
    t3 = t2 - t1;

  if ( t3 < delayTime ) {
    delayMicroseconds(delayTime - t3);


Ran a test on the shield and it completed the test fine? so maybe its a incompatibility with the sketch and the shield.

The Usb host shield is a Keys by funduino.

I’ve got the same host shield and have used this code so it does work.
You say you have tried different IDE’s I found it would work best if I used the later nightly build rather than the one I installed. Just download and run it from the zip.

Give that a go and report back.

Cheers for that.

I tried as you said with the nightly build, what rev worked for you ?

Still not working, are you getting the rx led blinking when it receives midi in.

i do think its an Ide problem more than hardware.

I'm using 1.6.6.

On closer inspection of the code you posted, is that the bidirectional converter from the example? If so then no that doesn't seem to work for anyone, you might be better asking the library author directly.

The way I have got everything configured is a USB MIDI keyboard is connected to the host shield and this is converted to real MIDI out. I also have a real MIDI in circuit. Both get sent to the real MIDI out.

I think what you want to do is a real MIDI input to USB MIDI output?
This code wont do that as it stands. :frowning:

My setup is in bits at the moment so can't check if I get a flashing LED.

I found this site useful: Arduino USB MIDI converter there is also a link to a PDF which was useful too.
Someone on that page said they have the got this code to work though.

I think it will need a bit of coding but should be possible.

Thanks for that...

i see one person got it working it must be down to the revision of the usbh_midi and the ide.

i am thinking of getting one of these the owner says it will do the same job.


I would suggest before getting anything else that you forget about the midi in part for now and try to send some commands vis the USB.
This will show if the library is working and board is working.

We know the MIDI in part will work.