We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I'm using 4 x 4 keypad to send the output to 2 7-segment LED.
problem: key de bouncing problem
Summary problem: when I press key, it shows both digit on the left and right. For example, if I first press 1, it should show 1 on the right and blank on the left. If I press 3 next, it should show 1 on the left and 3 on the right. Right now, it I press 1 it shows 1 on the left and 1 on the right. I think this relate to key debouncing. Please check my code.
void read(void) {
char left_val = 'n';
char right_val = 'n';
char next_val = readKeyPad();
while(1){
next_val = readKeyPad();
if (right_val == next_val || next_val == 'n'){
printChar(left_val, Left);
delay(FRAME_PERIOD);
printChar(right_val, Right);
}
else {
left_val = right_val;
right_val = next_val;
} }