katastrophe
New member
Hi guys! I'm working on a project using a Teensy to send MIDI messages when buttons are pressed and released. Additionally, the system should handle LEDs that indicate the last button pressed. While the LEDs are working correctly, I can't capture the MIDI signals on my computer using MIDI-OX or other MIDI monitoring software. I have followed the documentation to configure MIDI-OX and ensured that my code reads and discards incoming MIDI messages to avoid issues with USB buffers, but I still can't get the MIDI messages to be detected.
The main reason to do this project it's because I want to change presets on a software called Archetype: Nolly, It's a software that has all my presets.
I'm doing this project because this is the only way for me to play live
Code
#include <Bounce.h>
#include <MIDI.h>
MIDI_CREATE_DEFAULT_INSTANCE();
const int channel = 1;
const int buttonPins[] = {2, 3, 4, 5, 20, 21, 22, 23};
const int ledPins[] = {6, 7, 8, 9, 16, 17, 18, 19};
// Configure buttons with 5 ms debounce time
Bounce buttons[8] = {
Bounce(buttonPins[0], 5),
Bounce(buttonPins[1], 5),
Bounce(buttonPins[2], 5),
Bounce(buttonPins[3], 5),
Bounce(buttonPins[4], 5),
Bounce(buttonPins[5], 5),
Bounce(buttonPins[6], 5),
Bounce(buttonPins[7], 5)
};
int lastButtonPressed = -1; // Variable to track the last button pressed
void setup() {
// Set button pins as input with internal pullup
for (int i = 0; i < 8; i++) {
pinMode(buttonPins, INPUT_PULLUP);
pinMode(ledPins, OUTPUT);
digitalWrite(ledPins, LOW); // Turn off all LEDs initially
}
// Start MIDI
MIDI.begin(MIDI_CHANNEL_OMNI);
}
void loop() {
// Update the state of the buttons
for (int i = 0; i < 8; i++) {
buttons.update();
}
// Check if any button was pressed or released
for (int i = 0; i < 8; i++) {
if (buttons.fallingEdge()) {
MIDI.sendNoteOn(60 + i, 99, channel); // Send Note On message (60 + i is the MIDI note)
lastButtonPressed = i; // Update the last button pressed
}
if (buttons.risingEdge()) {
MIDI.sendNoteOff(60 + i, 0, channel); // Send Note Off message
}
}
// Turn on only the LED of the last button pressed and turn off the others
for (int i = 0; i < 8; i++) {
if (i == lastButtonPressed) {
digitalWrite(ledPins, HIGH);
} else {
digitalWrite(ledPins, LOW);
}
}
// Read and discard incoming MIDI messages
while (MIDI.read()) {
// read and discard incoming messages
}
}
```
I can't capture the MIDI signals on my computer. Any ideas on what might be wrong or what else I can try to resolve this issue?
I hope someone can help me please!!
I' using a Teensy 4.0
The main reason to do this project it's because I want to change presets on a software called Archetype: Nolly, It's a software that has all my presets.
I'm doing this project because this is the only way for me to play live
Code
#include <Bounce.h>
#include <MIDI.h>
MIDI_CREATE_DEFAULT_INSTANCE();
const int channel = 1;
const int buttonPins[] = {2, 3, 4, 5, 20, 21, 22, 23};
const int ledPins[] = {6, 7, 8, 9, 16, 17, 18, 19};
// Configure buttons with 5 ms debounce time
Bounce buttons[8] = {
Bounce(buttonPins[0], 5),
Bounce(buttonPins[1], 5),
Bounce(buttonPins[2], 5),
Bounce(buttonPins[3], 5),
Bounce(buttonPins[4], 5),
Bounce(buttonPins[5], 5),
Bounce(buttonPins[6], 5),
Bounce(buttonPins[7], 5)
};
int lastButtonPressed = -1; // Variable to track the last button pressed
void setup() {
// Set button pins as input with internal pullup
for (int i = 0; i < 8; i++) {
pinMode(buttonPins, INPUT_PULLUP);
pinMode(ledPins, OUTPUT);
digitalWrite(ledPins, LOW); // Turn off all LEDs initially
}
// Start MIDI
MIDI.begin(MIDI_CHANNEL_OMNI);
}
void loop() {
// Update the state of the buttons
for (int i = 0; i < 8; i++) {
buttons.update();
}
// Check if any button was pressed or released
for (int i = 0; i < 8; i++) {
if (buttons.fallingEdge()) {
MIDI.sendNoteOn(60 + i, 99, channel); // Send Note On message (60 + i is the MIDI note)
lastButtonPressed = i; // Update the last button pressed
}
if (buttons.risingEdge()) {
MIDI.sendNoteOff(60 + i, 0, channel); // Send Note Off message
}
}
// Turn on only the LED of the last button pressed and turn off the others
for (int i = 0; i < 8; i++) {
if (i == lastButtonPressed) {
digitalWrite(ledPins, HIGH);
} else {
digitalWrite(ledPins, LOW);
}
}
// Read and discard incoming MIDI messages
while (MIDI.read()) {
// read and discard incoming messages
}
}
```
I can't capture the MIDI signals on my computer. Any ideas on what might be wrong or what else I can try to resolve this issue?
I hope someone can help me please!!
I' using a Teensy 4.0