The software visualizes the bouncing of your switches on your Serial Monitor. It appears that bouncing is happening in microseconds instead of milliseconds. Push buttons generally perform better than toggle switches, in that sense that they provide a stable signal much earlier. Examples are shown in the result file in the file section.

Typical debounce code for a switch could be like this:

  signal = 0; 
  for (int i = 0; i <= {sample size}; i++) { // eliminate bouncing
    signal += !digitalRead(IN);
  }
  pressed = (signal > {threshold});

The sample size needed for proper debouncing can be derived from the upper scale of the monitor. The number of bounced samples is given explicitly. The threshold is prefarably larger than signal/2.

Debouncing a rotary switch can be done with the following code:

  rot = 0;
  for (int i = 0; i <= {sample size}; i++) { // eliminate bouncing
    signalA = digitalRead(ROTA);
    signalB = digitalRead(ROTB);
    if (signalA > signalB) rot -= 1;
    if (signalA < signalB) rot += 1;
  }
  if (rot == 0) {
    new_signal = true;
  } else {
 if ((rot < 0) && new_signal) {left turn};
    if ((rot > 0) && new_signal) {right turn};
    new_signal = false
  }