Usb keybord+arduino due

Hello ,

i have successfully interfaced usb keyboard and printing value on serial monitor.
in my program" enter_name() " this function print value of pres key but when i same key two time it print only one time. what improvement should i done in this function to solve my problem.

#include <KeyboardController.h>

// Initialize USB Controller

USBHost usb;

// Attach keyboard controller to USB

KeyboardController keyboard(usb);

char key,key1;

void setup()


  Serial.println("Program started");


void enter_name(){
 usb.Task();// Process USB tasks
//////////////////// I lock it because keyboard.getKey(); give same value two time////////////   
 {Serial.println(key); key1=key;} 

void loop()


To get rid of your issue with keys showing up twice, you added code so you can never have the same key twice in a row.

To fix it, add a void keyPressed() function which will get called each time a key is pressed. In that function you call keyboard.getKey() to get the key value.