Description
Context
Please answer a few questions to help us understand your problem better and guide you to a solution:
-
What board are you using ?
- same issue with Arduino Micro and Itsy Bitsy M4
- H11L1 optocoupler with 3.3V power supply
-
What version of the Arduino IDE are you using ?
- 2.3.4 IDE
-
How are you using MIDI ?
- Hardware Serial (DIN plugs)
- USB
- Other (please specify)
-
Is your problem related to:
- MIDI Input (reading messages from other devices)
- MIDI Output (sending messages to other devices)
-
How comfortable are you with code ?
- Complete beginner
- I've done basic projects
- I know my way around C/C++
- Advanced / professional
Describe your project and what you expect to happen:
I try to turn on lights when I receive a CC command. set to CC 11 on channel 1 the value is sent to the leds.
Describe your problem (what does not work):
I randomly receive wrong CC number when I turn only the CC11 knob on my M-audio oxygen keyboard
Steps to reproduce
I've check the hardware on scope for delay, and all works fine, I've tried the keyboard under midi ox with usb adapter > the keyboard works fine.
it's as if there was a buffer overflow and in this case, a bad CC was sent.
the test code is as simple as this (the led is used for local debug):
void handleCC(byte channel, byte controler, byte value)
{
controler_channel = channel;
controler_number = controler;
controler_value = value;
cc_flag = 1; // value received
if(controler_number != 11 )
{
digitalWrite(LED, HIGH);
delay(100);
digitalWrite(LED, LOW);
}
}
main loop:
void loop()
{
MIDI.read();
}
when I play quickly with the button, making mini maxi jumps, the blue LED flashes while everything starts from the keyboard in CC11 channel 1
test with callbacks and with cortex M4 power > same thing.