Hi,
Continuing my experiments on MIDI, I encounter another issue...
I am trying this simple code:
But when I try to open the serial monitor, I have this error : usb:0/140000/0/D is not available
I have tried USB type as "MIDI" and "Serial + MIDI" with no success.
Continuing my experiments on MIDI, I encounter another issue...
I am trying this simple code:
Code:
int potPin = A5;
const int numReadings = 20;
int readings[numReadings]; // the readings from the analog input
int readIndex = 0; // the index of the current reading
int total = 0; // the running total
int average = 0; // the average
int lastAverage;
void setup()
{
pinMode(potPin, INPUT);
usbMIDI.setHandleControlChange(OnControlChange);
Serial.begin(9600);
for (int thisReading = 0; thisReading < numReadings; thisReading++) {
readings[thisReading] = 0;
}
}
void loop()
{
usbMIDI.read();
//if there is a change, send and print it as a CC message
if(average != lastAverage)
{
usbMIDI.sendControlChange(7, average, 16);
Serial.print("Sent Volume: ");
Serial.println(average);
}
lastAverage = average;
delay(1);
}
void smoothing()
{
total = total - readings[readIndex];
readings[readIndex] = analogRead(potPin);
total = total + readings[readIndex];
readIndex = readIndex + 1;
if (readIndex >= numReadings) {
readIndex = 0;
}
average = total / numReadings / 8;
}
void OnControlChange(byte channel, byte control, byte value)
{
Serial.println("Channel: ");
Serial.print(channel);
Serial.println("Control: ");
Serial.print(control);
Serial.println("Value: ");
Serial.print(value);
}
But when I try to open the serial monitor, I have this error : usb:0/140000/0/D is not available
I have tried USB type as "MIDI" and "Serial + MIDI" with no success.