Hey Folks,
my Midi device receives no notes from my Teensy whereas serialprint.ln displays the midi values correctly - can you please help me to find the error!?
Midi Port Connections:
Midi Port 5 is connected to Pin 1 of my Teensy LC using a 47 Ohm resistor.
Midi Port 2 is connected to GND.
Midi Port 4 is connected to 3.3 V of my Teensy LC using a 47 Ohm resistor.
Tools: USB Type is set to MIDI; CPU speed is set to 48 MHz.
The Scale is chosen through A1.
The Note that should be sent through the midi port is chosen through A0.
The Note should be kept until another one is chosen. -> SerialPrint.ln displays this as wanted, but the Midi device does not get this notes!
Here's the main part of my code:
Do you have any ideas where the problem is?
Thanks in advance,
Marl
my Midi device receives no notes from my Teensy whereas serialprint.ln displays the midi values correctly - can you please help me to find the error!?
Midi Port Connections:
Midi Port 5 is connected to Pin 1 of my Teensy LC using a 47 Ohm resistor.
Midi Port 2 is connected to GND.
Midi Port 4 is connected to 3.3 V of my Teensy LC using a 47 Ohm resistor.
Tools: USB Type is set to MIDI; CPU speed is set to 48 MHz.
The Scale is chosen through A1.
The Note that should be sent through the midi port is chosen through A0.
The Note should be kept until another one is chosen. -> SerialPrint.ln displays this as wanted, but the Midi device does not get this notes!
Here's the main part of my code:
Code:
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12,11,5,4,2,3);
void setup() {
// put your setup code here, to run once:
MIDI.begin();
Serial.begin(31250);
// set up the LCD's number of rows and columns:
lcd.begin(16, 2);
// include reverse switch
pinMode(16, INPUT_PULLUP);
}
void loop() {
// put your main code here, to run repeatedly:
// The pot on A1 selects which of the 20 scales we pull notes from
int whichScale = (analogRead(A1) * 20) / 1024;
const int *theChosenScale = Scales[whichScale];
int theChosenScalesLength = ScaleLength[whichScale];
char theChosenScaleName = (*Scales_Names[whichScale]);
// The pot on A0 selects a note from the chosen scale
int whichNoteOfScale = (analogRead(A0) * theChosenScalesLength) / 1024;
// If the switch is set to reverse, reverse the direction of the sequence
if (digitalRead(16) == HIGH) {
const int theNote = theChosenScale[((theChosenScalesLength - 1) - whichNoteOfScale)];
lcd.setCursor(6, 1);
//print that the Scale is in reverse mode
lcd.print("Reverse");
lcd.setCursor(0, 0);
lcd.print(whichScale);
lcd.setCursor(6, 0);
lcd.print(theChosenScaleName);
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the note being played:
lcd.print(theNote);
MIDI.sendNoteOn(theNote, 127, 1);
Serial.println(theNote);
} else {
const int theNote = theChosenScale[whichNoteOfScale];
lcd.setCursor(6, 1);
//print that the Scale is in normal mode
lcd.print("Normal ");
lcd.setCursor(0, 0);
lcd.print(whichScale);
lcd.setCursor(6, 0);
lcd.print(theChosenScaleName);
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
MIDI.sendNoteOn(theNote, 127, 1);
Serial.println(theNote);
}
Do you have any ideas where the problem is?
Thanks in advance,
Marl