 int ppqn = 0;
 
 void setup(){
+
 Serial.begin(115200);
 
-for (int i=2; i<=7; i++){pinMode(i, INPUT);} // Set Inputs
+for (int i=2; i<=9; i++){pinMode(i, INPUT);} // Set Inputs
 
 for (int i=22; i<=35; i++){pinMode(i, INPUT);} // Set Inputs
 

}

void setMidiOut(){

valSongSwitch = digitalRead(SongSwitch); // Read Analog Input
 if (lastSongSwitch != valSongSwitch){ // Only send Midi CC if changed is detected
  controlChange(MidiChannel, 40, valSongSwitch); // Send CC

  }

}

void sendJogWheel()
{
 // read both inputs
  int a = digitalRead(JogWheelPinA);
  int b = digitalRead(JogWheelPinB);
 
  if (a == b )
  {
    // b is leading a (counter-clockwise)
    valJogWheel--;
    currentDirection = COUNTER_CLOCKWISE;
  }
  else
  {
    // a is leading b (clockwise)
    valJogWheel++;
    currentDirection = CLOCKWISE;
  }
 
  // track 0 to 400
  valJogWheel = valJogWheel % CPR;

  mappedvalJogWheel = map(abs(valJogWheel), 0, JogWheelMaxval, 0, 127);
  
  controlChange(MidiChannel, 63, 127); // Send CC For JogWheel Activity
  JogWheelActive = 1;  
    if (currentDirection = CLOCKWISE){
     controlChange(MidiChannel, 61, mappedvalJogWheel); // Send CC For JogWheel Direction
      }
     if (currentDirection = COUNTER_CLOCKWISE){
     controlChange(MidiChannel, 62, mappedvalJogWheel); // Send CC For JogWheel Direction
      }
  MidiUSB.flush(); // Be sure CC is Send
  valJogWheel = 0;
  }
}
