user85947: I'm using a rotary encoder on my Arduino Micro, that is supposed to do single steps or ten steps at once, depending on which position a switch is in.
The Rotary: https://www.reichelt.de/drehimpulsegeber-15-impulse-30-rastungen-vertikal-ec11mvbfx-p315144.html?&nbc=1 (on this site are pictures and datasheets as well.)
The Switch:
https://www.reichelt.de/miniatur-kippschalter-ein-aus-ein-3-a-250-v-goobay-10023-p285990.html?&nbc=1
Wiring: (image following later)

        1--------Pin16 |  Pin A3----Switch
Rotary  2--------GND   |  GND-------|
        3--------PIN17 |


The rotary encoder gives no output, neither the Serial.print nor the gamecontroller. Also there is no output in either switch position.
EDIT:
After using arrays and loops like @jsotola teached me, it works nearly the way its supposed to, but sometimes, although the switch is off, it clicks ten times.
The code looks like this shortened now
#include <Arduino.h>
#include <Joystick.h>
#include <BasicEncoder.h>
#include <TimerOne.h>

int EncoderPins[] = {
  4, 5, 6, 7, 8, 9, 10, 11
};
int EncoderCount = 8;

BasicEncoder encoder4(EncoderPins[6], EncoderPins[7], HIGH, 2);

void timer_service() {
  encoder4.service();
}

#define joyButton16 EncoderPins[6]  // Rotary4
#define joyButton17 EncoderPins[7]  // Rotary4
#define joyButton18 21              // HDG_SWITCH := Switch to select between single and 10 steps

//Joystick(Joystick HID ID, Joystick Type, Button Count, Hat Switch Count, Include X, Include Y, Include Z, Include Rx, Include Ry, Include Rz, Include Rudder, Include Throttle, Include Accelerator, Include Brake, Include Steering)
Joystick_ Joystick(0x15, JOYSTICK_TYPE_JOYSTICK, 19, 0,
                   true /*X*/, false/*Y*/, false/*X*/,
                   false/*Rx*/, false/*Ry*/, false/*Rz*/,
                   false/*Rudder*/, false/*Throttle*/, false/*Acc*/,
                   false/*Brake*/, false/*Steer*/);

const bool initAutoSendState = true; // code is sends continuously and doesnt wait for polling

int EncoderState[] = {
  0, 0, 0, 0
};

void setup() {
  for (int q  = 0; q < EncoderCount; q++)
  {
    pinMode(EncoderPins[q], INPUT_PULLUP);
  }

  Serial.begin(9600);
  Joystick.begin();

  Timer1.initialize(100);
  Timer1.attachInterrupt(timer_service);
}

void loop() {
  GET_CHANGE();

  int CurrentButton18State = !digitalRead(joyButton18);
  switch(CurrentButton18State){
    case 0: 
      switch(EncoderState[3]){
        case  1: clickButton(15); Serial.println(EncoderState[3]); break;
        case -1: clickButton(16); Serial.println(EncoderState[3]); break;
        } break;
    case 1:
      switch(EncoderState[3]){
        case  1: clickTen(15); break;
        case -1: clickTen(16); break;
        } break;
  }
}

void clickButton(int pin) {
  Joystick.setButton(pin, 1);
  delay(2);
  Joystick.setButton(pin, 0);
}

void clickTen(int pin) {
  for (int ii = 0; ii < 10; ii++)
  {
    clickButton(pin);
    Serial.println("step: "); Serial.println(ii);
    delay(10);
  }
}
void GET_CHANGE()
{
  for(int E = 0; E<4; E++)
  switch(E) {
    case 3: EncoderState[E] = encoder4.get_change(); break;
  }
}


user40318: This is not an answer to the question, but a tip about simplifying your code.
This is a snippet of your code.

void loop() {

// some more code here


  int encoder1State = encoder1.get_change();
  switch (encoder1State) {
    case 1:
      Joystick.setButton(8, 1);
      delay(25);
      Joystick.setButton(8, 0);
      //Serial.println(encoder1State);
      break;
    case -1:
      Joystick.setButton(9, 1);
      delay(25);
      Joystick.setButton(9, 0);
      //Serial.println(encoder1State);
      break;
    case 0:
      break;
  }
  int encoder2State = encoder2.get_change();
  switch (encoder2State) {
    case 1:
      Joystick.setButton(10, 1);
      delay(25);
      Joystick.setButton(10, 0);
      //Serial.println(encoder1State);
      break;
    case -1:
      Joystick.setButton(11, 1);
      delay(25);
      Joystick.setButton(11, 0);
      //Serial.println(encoder1State);
      break;
    case 0:
      break;
  }
  int encoder3State = encoder3.get_change();
  switch (encoder3State) {
    case 1:
      Joystick.setButton(12, 1);
      delay(25);
      Joystick.setButton(12, 0);
      //Serial.println(encoder1State);
      break;
    case -1:
      Joystick.setButton(13, 1);
      delay(25);
      Joystick.setButton(13, 0);
      //Serial.println(encoder1State);
      break;
    case 0:
      break;
  }
  int currentButton20State = !digitalRead(joyButton20);
  int encoder4State = encoder4.get_change();
  switch (currentButton20State) {
    case 0:
      switch (encoder4State) {
        case 1:
          Joystick.setButton(14, 1);
          delay(25);
          Joystick.setButton(14, 0);
          Serial.println(encoder4State);
          break;
        case -1:
          Joystick.setButton(15, 1);
          delay(25);
          Joystick.setButton(15, 0);
          Serial.println(encoder4State);
          break;
        case 0:
          break;
      } break;
    case 1:
      switch (encoder4State) {

        case 1:
          TenRotaryStepsUP();
          break;
        case -1:
          TenRotaryStepsDOWN();
          break;
        case 0:
          break;
      } break;
  }

  //GetParamFromFS2020();
  //ShowFlightParam();

  delay(10);

}

void TenRotaryStepsUP()
{
  for (int i = 0; i < 10; i++)
  {
    Joystick.setButton(14, 1);
    delay(25);  //for testing set on higher number e.g. 500
    Joystick.setButton(14, 0);
    Serial.println("step: "); Serial.println(i);
    delay(10);
  }
}

void TenRotaryStepsDOWN()
{
  for (int i = 0; i < 10; i++)
  {
    Joystick.setButton(15, 1);
    delay(25);
    Joystick.setButton(15, 0);
    Serial.println("step: "); Serial.println(i);
    delay(10);
  }
}

It can be simplified by putting repeated code into functions.

void loop() {

// some more code here


  int encoder1State = encoder1.get_change();
//Serial.println(encoder1State);
  switch (encoder1State) {
    case 1:
      clickButton(8);
      break;
    case -1:
      clickButton(9);
      break;
    case 0:
      break;
  }

  int encoder2State = encoder2.get_change();
  switch (encoder2State) {
    case 1:
      clickButton(10);
      break;
    case -1:
      clickButton(11);
      break;
    case 0:
      break;
  }

  int encoder3State = encoder3.get_change();
  switch (encoder3State) {
    case 1:
      clickButton(12);
      break;
    case -1:
      clickButton(13);
      break;
    case 0:
      break;
  }

  int currentButton20State = !digitalRead(joyButton20);

  int encoder4State = encoder4.get_change();
  switch (currentButton20State) {

    case 0:
      switch (encoder4State) {
        case 1:
          clickButton(14);
          break;
        case -1:
          clickButton(15);
          break;
        case 0:
          break;
      } break;

    case 1:
      switch (encoder4State) {
        case 1:
          clickTen(14);
          break;
        case -1:
          clickTen(15);
          break;
        case 0:
          break;
      } break;
  }

  //GetParamFromFS2020();
  //ShowFlightParam();

  delay(10);

}

void clickButton(int pin) {
  Joystick.setButton(pin, 1);
  delay(25);
  Joystick.setButton(pin, 0);
}

void clickTen(int pin) {
  for (int i = 0; i < 10; i++)
  {
    clickButton(pin);
    Serial.println("step: "); Serial.println(i);
    delay(10);
  }
}   

You can even format your code like this.
switch (encoder3State) {
  case  1:      clickButton(12);      break;
  case -1:      clickButton(13);      break;
  case  0:                            break;
}

EDIT
Also refer to the following about the use of arrays as variables, to specify pins, instead of individual variable names
https://www.arduino.cc/en/Tutorial/BuiltInExamples/Arrays
eg. use lastButtonState[1] instead of lastButton1State and joyButton[1] instead of joyButton1
that will allow the use of for loops to repeat the same action for multiple pins
int currentButton2State = !digitalRead(joyButton2);
if (currentButton2State != lastButton2State) {
  Joystick.setButton(1, currentButton2State);
  if (currentButton2State == 1) {
    delay(1);
    Joystick.setButton(1, 0);
  }
  lastButton2State = currentButton2State;
}

becomes
int currentButtonState[pin] = !digitalRead(joyButton[pin]);
if (currentButtonState[pin] != lastButtonState[pin]) {
  Joystick.setButton(pin-1, currentButtonState[pin]);
  if (currentButtonState[pin] == 1) {
    delay(1);
    Joystick.setButton(pin-1, 0);
  }
  lastButtonState[pin] = currentButtonState[pin];
}


85947: <p>I'm using a rotary encoder on my Arduino Micro, that is supposed to do single steps or ten steps at once, depending on which position a switch is in.</p>
<p>The Rotary: <a href="https://www.reichelt.de/drehimpulsegeber-15-impulse-30-rastungen-vertikal-ec11mvbfx-p315144.html?&amp;nbc=1" rel="nofollow noreferrer">https://www.reichelt.de/drehimpulsegeber-15-impulse-30-rastungen-vertikal-ec11mvbfx-p315144.html?&amp;nbc=1</a> (on this site are pictures and datasheets as well.)</p>
<p>The Switch:
<a href="https://www.reichelt.de/miniatur-kippschalter-ein-aus-ein-3-a-250-v-goobay-10023-p285990.html?&amp;nbc=1" rel="nofollow noreferrer">https://www.reichelt.de/miniatur-kippschalter-ein-aus-ein-3-a-250-v-goobay-10023-p285990.html?&amp;nbc=1</a></p>
<p>Wiring: (image following later)</p>
<blockquote>
<pre><code>        1--------Pin16 |  Pin A3----Switch
Rotary  2--------GND   |  GND-------|
        3--------PIN17 |
</code></pre>
</blockquote>
<p>The rotary encoder gives no output, neither the Serial.print nor the gamecontroller. Also there is no output in either switch position.</p>
<p><strong>EDIT:</strong>
After using arrays and loops like @jsotola teached me, it works nearly the way its supposed to, but sometimes, although the switch is off, it clicks ten times.
The code looks like this shortened <strong>now</strong></p>
<pre><code>#include &lt;Arduino.h&gt;
#include &lt;Joystick.h&gt;
#include &lt;BasicEncoder.h&gt;
#include &lt;TimerOne.h&gt;

int EncoderPins[] = {
  4, 5, 6, 7, 8, 9, 10, 11
};
int EncoderCount = 8;

BasicEncoder encoder4(EncoderPins[6], EncoderPins[7], HIGH, 2);

void timer_service() {
  encoder4.service();
}

#define joyButton16 EncoderPins[6]  // Rotary4
#define joyButton17 EncoderPins[7]  // Rotary4
#define joyButton18 21              // HDG_SWITCH := Switch to select between single and 10 steps

//Joystick(Joystick HID ID, Joystick Type, Button Count, Hat Switch Count, Include X, Include Y, Include Z, Include Rx, Include Ry, Include Rz, Include Rudder, Include Throttle, Include Accelerator, Include Brake, Include Steering)
Joystick_ Joystick(0x15, JOYSTICK_TYPE_JOYSTICK, 19, 0,
                   true /*X*/, false/*Y*/, false/*X*/,
                   false/*Rx*/, false/*Ry*/, false/*Rz*/,
                   false/*Rudder*/, false/*Throttle*/, false/*Acc*/,
                   false/*Brake*/, false/*Steer*/);

const bool initAutoSendState = true; // code is sends continuously and doesnt wait for polling

int EncoderState[] = {
  0, 0, 0, 0
};

void setup() {
  for (int q  = 0; q &lt; EncoderCount; q++)
  {
    pinMode(EncoderPins[q], INPUT_PULLUP);
  }

  Serial.begin(9600);
  Joystick.begin();

  Timer1.initialize(100);
  Timer1.attachInterrupt(timer_service);
}

void loop() {
  GET_CHANGE();

  int CurrentButton18State = !digitalRead(joyButton18);
  switch(CurrentButton18State){
    case 0: 
      switch(EncoderState[3]){
        case  1: clickButton(15); Serial.println(EncoderState[3]); break;
        case -1: clickButton(16); Serial.println(EncoderState[3]); break;
        } break;
    case 1:
      switch(EncoderState[3]){
        case  1: clickTen(15); break;
        case -1: clickTen(16); break;
        } break;
  }
}

void clickButton(int pin) {
  Joystick.setButton(pin, 1);
  delay(2);
  Joystick.setButton(pin, 0);
}

void clickTen(int pin) {
  for (int ii = 0; ii &lt; 10; ii++)
  {
    clickButton(pin);
    Serial.println(&quot;step: &quot;); Serial.println(ii);
    delay(10);
  }
}
void GET_CHANGE()
{
  for(int E = 0; E&lt;4; E++)
  switch(E) {
    case 3: EncoderState[E] = encoder4.get_change(); break;
  }
}
</code></pre>
 40318: <p>This is not an answer to the question, but a tip about simplifying your code.</p>
<p>This is a snippet of your code.</p>
<pre class="lang-cpp prettyprint-override"><code>
void loop() {

// some more code here


  int encoder1State = encoder1.get_change();
  switch (encoder1State) {
    case 1:
      Joystick.setButton(8, 1);
      delay(25);
      Joystick.setButton(8, 0);
      //Serial.println(encoder1State);
      break;
    case -1:
      Joystick.setButton(9, 1);
      delay(25);
      Joystick.setButton(9, 0);
      //Serial.println(encoder1State);
      break;
    case 0:
      break;
  }
  int encoder2State = encoder2.get_change();
  switch (encoder2State) {
    case 1:
      Joystick.setButton(10, 1);
      delay(25);
      Joystick.setButton(10, 0);
      //Serial.println(encoder1State);
      break;
    case -1:
      Joystick.setButton(11, 1);
      delay(25);
      Joystick.setButton(11, 0);
      //Serial.println(encoder1State);
      break;
    case 0:
      break;
  }
  int encoder3State = encoder3.get_change();
  switch (encoder3State) {
    case 1:
      Joystick.setButton(12, 1);
      delay(25);
      Joystick.setButton(12, 0);
      //Serial.println(encoder1State);
      break;
    case -1:
      Joystick.setButton(13, 1);
      delay(25);
      Joystick.setButton(13, 0);
      //Serial.println(encoder1State);
      break;
    case 0:
      break;
  }
  int currentButton20State = !digitalRead(joyButton20);
  int encoder4State = encoder4.get_change();
  switch (currentButton20State) {
    case 0:
      switch (encoder4State) {
        case 1:
          Joystick.setButton(14, 1);
          delay(25);
          Joystick.setButton(14, 0);
          Serial.println(encoder4State);
          break;
        case -1:
          Joystick.setButton(15, 1);
          delay(25);
          Joystick.setButton(15, 0);
          Serial.println(encoder4State);
          break;
        case 0:
          break;
      } break;
    case 1:
      switch (encoder4State) {

        case 1:
          TenRotaryStepsUP();
          break;
        case -1:
          TenRotaryStepsDOWN();
          break;
        case 0:
          break;
      } break;
  }

  //GetParamFromFS2020();
  //ShowFlightParam();

  delay(10);

}

void TenRotaryStepsUP()
{
  for (int i = 0; i &lt; 10; i++)
  {
    Joystick.setButton(14, 1);
    delay(25);  //for testing set on higher number e.g. 500
    Joystick.setButton(14, 0);
    Serial.println(&quot;step: &quot;); Serial.println(i);
    delay(10);
  }
}

void TenRotaryStepsDOWN()
{
  for (int i = 0; i &lt; 10; i++)
  {
    Joystick.setButton(15, 1);
    delay(25);
    Joystick.setButton(15, 0);
    Serial.println(&quot;step: &quot;); Serial.println(i);
    delay(10);
  }
}
</code></pre>
<p>It can be simplified by putting repeated code into functions.</p>
<pre class="lang-cpp prettyprint-override"><code>
void loop() {

// some more code here


  int encoder1State = encoder1.get_change();
//Serial.println(encoder1State);
  switch (encoder1State) {
    case 1:
      clickButton(8);
      break;
    case -1:
      clickButton(9);
      break;
    case 0:
      break;
  }

  int encoder2State = encoder2.get_change();
  switch (encoder2State) {
    case 1:
      clickButton(10);
      break;
    case -1:
      clickButton(11);
      break;
    case 0:
      break;
  }

  int encoder3State = encoder3.get_change();
  switch (encoder3State) {
    case 1:
      clickButton(12);
      break;
    case -1:
      clickButton(13);
      break;
    case 0:
      break;
  }

  int currentButton20State = !digitalRead(joyButton20);

  int encoder4State = encoder4.get_change();
  switch (currentButton20State) {

    case 0:
      switch (encoder4State) {
        case 1:
          clickButton(14);
          break;
        case -1:
          clickButton(15);
          break;
        case 0:
          break;
      } break;

    case 1:
      switch (encoder4State) {
        case 1:
          clickTen(14);
          break;
        case -1:
          clickTen(15);
          break;
        case 0:
          break;
      } break;
  }

  //GetParamFromFS2020();
  //ShowFlightParam();

  delay(10);

}

void clickButton(int pin) {
  Joystick.setButton(pin, 1);
  delay(25);
  Joystick.setButton(pin, 0);
}

void clickTen(int pin) {
  for (int i = 0; i &lt; 10; i++)
  {
    clickButton(pin);
    Serial.println(&quot;step: &quot;); Serial.println(i);
    delay(10);
  }
}   
</code></pre>
<p>You can even format your code like this.</p>
<pre class="lang-cpp prettyprint-override"><code>switch (encoder3State) {
  case  1:      clickButton(12);      break;
  case -1:      clickButton(13);      break;
  case  0:                            break;
}
</code></pre>
<p>EDIT</p>
<p>Also refer to the following about the use of arrays as variables, to specify pins, instead of individual variable names</p>
<p><a href="https://www.arduino.cc/en/Tutorial/BuiltInExamples/Arrays" rel="nofollow noreferrer">https://www.arduino.cc/en/Tutorial/BuiltInExamples/Arrays</a></p>
<p>eg. use <code>lastButtonState[1]</code> instead of <code>lastButton1State</code> and <code>joyButton[1]</code> instead of <code>joyButton1</code></p>
<p>that will allow the use of <code>for</code> loops to repeat the same action for multiple pins</p>
<pre class="lang-cpp prettyprint-override"><code>int currentButton2State = !digitalRead(joyButton2);
if (currentButton2State != lastButton2State) {
  Joystick.setButton(1, currentButton2State);
  if (currentButton2State == 1) {
    delay(1);
    Joystick.setButton(1, 0);
  }
  lastButton2State = currentButton2State;
}
</code></pre>
<p>becomes</p>
<pre class="lang-cpp prettyprint-override"><code>int currentButtonState[pin] = !digitalRead(joyButton[pin]);
if (currentButtonState[pin] != lastButtonState[pin]) {
  Joystick.setButton(pin-1, currentButtonState[pin]);
  if (currentButtonState[pin] == 1) {
    delay(1);
    Joystick.setButton(pin-1, 0);
  }
  lastButtonState[pin] = currentButtonState[pin];
}
</code></pre>
