Hello,
This is my first post, it's nice to be part of the community. I'm new to this, so apologies if I'm missing something.
I'm making a MIDI controller using and Arduino Uno and buttons to send note data to a synthesiser, and I'm having some issues with it. From what I can see using a MIDI monitoring program, the circuit is sending data but not the correct information - it isn't sending note data. It's definitely sending something, but it's not actually making any notes. The code and schematic is from this website, and I'll put it below as well: How to Make a MIDI Controller with an Arduino
I have downloaded the Arduino MIDI Library v5.0.2 as stated, and I've gone over the circuit closely and am confident it is correct. There are no error messages when I'm verifying the code.
Here is the code I'm using:
#include <MIDI.h>
#include <midi_Defs.h>
#include <midi_Message.h>
#include <midi_Namespace.h>
#include <midi_Settings.h>
const int buttonOne = 6; // assign button pin to variable
const int buttonTwo = 7; // assign button pin to variable
MIDI_CREATE_INSTANCE(HardwareSerial,Serial, midiOut); // create a MIDI object called midiOut
void setup() {
pinMode(buttonOne,INPUT); // setup button as input
pinMode(buttonTwo,INPUT); // setup button as input
Serial.begin(31250); // setup MIDI output
}
void loop() {
if(digitalRead(buttonOne) == HIGH) { // check button state
delay(10); // software de-bounce
if(digitalRead(buttonOne) == HIGH) { // check button state again
midiOut.sendControlChange(56,127,1); // send a MIDI CC -- 56 = note, 127 = velocity, 1 = channel
delay(250);
}
}
if(digitalRead(buttonTwo) == HIGH) { // check button state
delay(10); // software de-bounce
if(digitalRead(buttonTwo) == HIGH) { // check button state again
midiOut.sendControlChange(42,127,1); // send a MIDI CC -- 42 = note, 127 = velocity, 1 = channel
delay(250);
}
}
(I'm aware I'm meant to auto-format the code, but I can't find where to do that - sorry)
Here's the layout:
Using test code on the website, the two buttons are working as they should, so it's an isolated issue with the MIDI. Here is the information being received by the MIDI monitoring program by running the MIDI out into my audio interface. The channel number matches the code, but as you can see there is no note data recognised. Data 1 changes from 38 to 2A when I press and hold button 2 instead of button 1 (though I'm not quite sure what the Data 1 means).
If anyone could point me in the right direction, that would be great. Thanks!