Go Down

Topic: (UPDATED) Trying to make a simple button to MIDI cc controller (Read 2780 times) previous topic - next topic

trixdropd

I have been trying to make a button to midi cc controller.


In my sketch, it works perfect when connected to the device I wish to control. But when I monitor the output in MIDI OX it is showing a status byte as 144 (Program Change)  rather than the 191 (Control Change) it should be.  


When I use my desired device to control it's Arduino Midi out>Midi device

When I check status in MIDI ox its Arduino MIDI out>USB Midi Interface In

The status should be 191 each time, why is it switching to 144?  What gives?


Thanks!

Jeremy


Here's a post with the same issue and a workaround that involves sending two cc messages to different midi channels, but that is crude. https://github.com/projectgus/hairless-midiserial/issues/16

And another where the op has the exact same issue... Seems like a MIDI Library fault?  http://forum.arduino.cc/index.php?topic=243001.15

btw, with MIDI OX hooked up on a reset of the Arduino the 1st output is always correct as status 191 but then button press 2 on are all 144 everytime. I don't get it.


On a fresh reset I get this:

once it's put out 1 message all output looks like this:


Code: [Select]

#include <MIDI.h>



MIDI_CREATE_DEFAULT_INSTANCE();

#define LED 13      // LED pin on Arduino Uno
#define switch1 2              // 1st Switch



//Variables
int switch1LastState = 0;
int switch1CurrentState = 0;

void setup()
{
    pinMode(LED, OUTPUT);
    pinMode(switch1,INPUT);
    MIDI.begin(4);          // Launch MIDI and listen to channel 4
}

void loop()
{
  switch1CurrentState = digitalRead(switch1);
    if (switch1CurrentState == 1)                // If button pressed
    {
        digitalWrite(LED,HIGH);
        MIDI.sendControlChange(80,127,16);  
        delay(1000);        
        MIDI.sendControlChange(80,0,16);  
        digitalWrite(LED,LOW);
    }
    
    
}



trixdropd


Grumpy_Mike

Your question does not contain enough information about your setup.
How is the MIDI getting form the Arduino to ( well where is it going ? )
Also your code does not set a baud rate, the correct speed will depend on your setup.

trixdropd

Your question does not contain enough information about your setup.
How is the MIDI getting form the Arduino to ( well where is it going ? )
Also your code does not set a baud rate, the correct speed will depend on your setup.
My midi out connector is connected as follows:



I'm sending midi out to a gcx guitar switcher loop device. It responds to midi CC on channel 16 via cc #'s 80-87. My setup functions correctly, but when I Monitor the output via MIDI ox I can see it's not exactly right.

I also have a ground control pro midi controller and midi ox see's the proper incoming message from it.


Thanks!



I assumed the Midi Library was setting my baud rate. Am I wrong?  I'll try to adjust that and see what happens. I want to use the midi spec as I'm using an actual midi out jack.

Grumpy_Mike

Quote
I assumed the Midi Library was setting my baud rate.
It is not because it needs to work with any speed, things like hairless require a much faster speed than the normal MIDI.

P.S. Never did like that direct circuit, I always put my MIDI through a transistor.

trixdropd

It is not because it needs to work with any speed, things like hairless require a much faster speed than the normal MIDI.

P.S. Never did like that direct circuit, I always put my MIDI through a transistor.
I tried changing the baud rate and it still behaves the same way. When I change the baud rate to something other than the MIDI standard 31250 that hairless supports, then Hairless passes along correct signal to midi ox.

Grumpy_Mike

Then I would try and swap pins 4 & 5 over on the MIDI connector. I would also split that resistor and have 120R in each line. This is to protect your arduino in the event of a short.

trixdropd

I will try that and report back. Thanks Grumpy Mike!

Go Up