Modifier Keys "Sticking" with Keyboard Code

Status
Not open for further replies.

coward.cameron

New member
Hello all!

I'm using a Teensy 3.2 to convert an old TI-99/4A keyboard into a USB keyboard. So far, it's working mostly properly. Here's the code I'm using for the regular keys:

Code:
  if(column3.fallingEdge()){
    if(fctn == true){
      Keyboard.press(KEY_QUOTE);
      Keyboard.release(KEY_QUOTE);
    } else {
      Keyboard.press(KEY_P); 
      Keyboard.release(KEY_P);
    }
  }

And here is the code I'm using for the modifier keys:

Code:
void checkModifiers(){                          // Check for modifier keys

  digitalWrite(rowF, LOW);
  column6.update();
  column7.update();
  column8.update();

  if(column6.fallingEdge()){                     // Check if Shift is pressed
   Keyboard.set_modifier(MODIFIERKEY_SHIFT);
   Keyboard.send_now();
   shft = true;
  }

  if(column6.risingEdge()){                      // Check if Shift is released
   Keyboard.set_modifier(0);
   Keyboard.send_now();
   shft = false;
  }

  if(column7.fallingEdge()){                     // Check if Ctrl is pressed
   Keyboard.set_modifier(MODIFIERKEY_CTRL);
   Keyboard.send_now();
  }

  if(column7.risingEdge()){                      // Check if Ctrl is released
   Keyboard.set_modifier(0);
   Keyboard.send_now();
  }

  if(column8.fallingEdge()){                     // Check if Function is pressed
   fctn = true;
  }

  if(column8.risingEdge()){                      // Check if Function is released
   fctn = false;
  }

  digitalWrite(rowF, HIGH);

}

The problem is that the modifier keys seem to be "sticking." For instance, I press and release the Shift key, it will act as if I'm holding it down. If I push it a bunch of times, it will eventually "release" it. If it matters, I've tried this with a bounce ranging from 10 to 100 ms. Does anyone know what might be causing it to stick, or how I can fix this?
 
Status
Not open for further replies.
Back
Top