Set countdown time with Keypad?

You're positioning the cursor in the same place, prior to printing each character, so they're bound to overwrite.

    lcd.setCursor(0,1); // set cursor at column 0 and row 1
    lcd.print(key); // print keypad character entry to lcd
    lcd.setCursor(6,1); // set cursor at column 0 and row 1
    lcd.print(key); // print keypad character entry to lcd

Anyone know how to do this?

It's trivial, if you are using NULL terminated arrays of chars to hold the digits entered. Just print the string to the LCD.

That worked, unless that the inputTimeArray prints numbers I don't type.

But no worry's about that, it's not that important. :wink:

Thanks for the help.

That worked, unless that the inputTimeArray prints numbers I don't type.

How could it, if you are properly storing data to it?

If I type 200 , it prints 01234
The 1234 is the password from the Setup. I don't know why it's storing the inputSetupArray in the inputTimeArray.
I'm taking a look at it now.

I'll post the code in a few seconds.

edit: here is the code: #include <LiquidCrystal.h>#include <ShiftLCD.h> // Include Library's - Pastebin.com

edit 2: After removing the 'inputTimeArray = '/0';' , it prints 20001234 after typing 20000.
edit 3: I found the solution! Adding the following fixed the problem:
```

  • x = 0;                      //Reset your entryindex so that it effectively clears your entry.
     inputSetupArray[x] = '\0';         //Always add the null*
    ```

So the array always needs to be cleared.

I've created a function when the bomb is disarmed, and the user presses '#', then all arrays reset, and the user gets redirected to the SETUP case.
Now the strange thing is, that when I need to enter the password in the SETUP case, and press one number on the keypad, then the whole inputSetupArray gets printed on the lcd.
It's strange because the arrays is reseted in the FINISHED function.

Here is the code:

This is how I reset the arrays:

char key = keypad.getKey();
  if(key == '#') {
    x = 0;      
    inputSetupArray[x] = '\0'; 

    i = 0;   
 inputTimeArray[i] = '\0'; 

    a = 0;                     
 inputArmArray[a] = '\0';

    b = 0;                      
 inputDisarmArray[b] = '\0'; 
 
    bombState = SETUP;
   
  }
    
}

Am I resetting it the wrong way or is there something else?

There is no need to search for the problem anymore, because I will power off the bomb each time after a game.

Hey man, i'm working at the same kind of project. Can u show me your arduino set up. Like your cable's and how everything is connected. And is the last link you punt in (#include <LiquidCrystal.h>#include <ShiftLCD.h> // Include Library's - Pastebin.com) the final code that makes everything works?