delete useless affection and check the value of "key" variable after the getch() because he return ERR after timer settled by the halfdelay() function