Skip to content

switch(MIDI.getType()) - working only first process #267

Answered by franky47
elektronek asked this question in Q&A
Discussion options

You must be logged in to vote

Can I see the rest of your code please?

MIDI.getType only returns the type of the last message received, so depending on where and when you call it, it may behave differently.

I would generally suggest to use callbacks to perform this kind of "if this type of message arrived, then do this" switching.

In your case:

void handleNoteOn(byte channel, byte note, byte velocity) {
  if (note==33||note==35||note==36) kickstate = 1;
}
void handleControlChange(byte channel, byte number, byte value) {
  digitalWrite(13, HIGH); // for indication, defined in setup as output, not used elsewhere
  if (number==102 && value > 0 && value < 17) count=value;
  if (number==103 && value > 0 && value < 9)  scene…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@franky47
Comment options

@elektronek
Comment options

@elektronek
Comment options

@franky47
Comment options

@elektronek
Comment options

Answer selected by elektronek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants