Question for countdown

I’d like to do a countdown. To do this I would like to enter with a keyboard a membrane a number on a 16x2 lcd screen and that this makes a timer up to 0. Currently what I can not understand and how to write the number for my timer and subtract it.

If you have leads I am taker. Thank you good day :slight_smile: :slight_smile:

Found with Google search for "countdown lcd keypad arduino". If these do not help, describe what you want in better detail.

Read the how to use this forum-please read sticky for some advice on how to ask an effective question.

With these links I tried to put a 3 digit number in a tank then that one subtracts 0 once these 3 digits written on my lcd screen. What I can’t do is how to get my number to 0 now. Here’s my code for more explanation

Thank you

#include <Wire.h>
#include <DS3231.h>
#include <LiquidCrystal.h>
#include <Keypad.h>

int tempPin = 0;

LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

int calibrationTime = 30;

long unsigned int lowIn;

int inputPin = 3;          
int pirState = LOW;
int val = 0;   
const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
  {'1', '2', '3'}
};

byte rowPins[ROWS] = {13};
byte colPins[COLS] = {5, 4, 2 };

char timer[3];
int number= 0;

//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS); 

void setup(){
  lcd.begin(16, 2);
  delay(2000);
  lcd.clear();
  lcd.clear();
  Serial.begin(9600);
  pinMode(inputPin, INPUT);
}
  
void loop()
{
  
  lcd.setCursor(0,0);
  lcd.print("Bomb explosion :"); 
  while(number< 3){
    lcd.setCursor(nombre + 0,1);
    lcd.cursor();
    char customKey = customKeypad.getKey();
    customKey == NO_KEY;
    if(customKey != NO_KEY){
      if((customKey != '*') && (customKey != '#')){
         lcd.print(customKey);
         Serial.println(customKey);
         timer[number] = customKey;
         number++;
              
      }
    }
  }
  while(number== 3){
    int sous = 1;
    number= (timer - sous);
    lcd.print(timer[number]);
  }  
  
}