From c72652133d0dd8a378e5e3424887fa42e2741ade Mon Sep 17 00:00:00 2001 From: Govind <52847415+govgoel@users.noreply.github.com> Date: Mon, 30 Sep 2019 23:11:51 +0530 Subject: [PATCH] Update challenge 5 Fixed some issue --- challenge 5 | 67 ++++++++++++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 27 deletions(-) diff --git a/challenge 5 b/challenge 5 index 225a77f..23960f0 100644 --- a/challenge 5 +++ b/challenge 5 @@ -1,36 +1,49 @@ -#include #include -//keboard -const byte rows = 4; -const byte columns = 4; -char Keys[rows][columns] = { +#include + +// initialize the library with the numbers of the interface pins +LiquidCrystal lcd(12, 11, 5, 4, 3, A4); + String password = "5421"; + int temp; + int keypressed; + + const byte ROWS=4; + const byte COL =4; + char keys[ROWS][COL] = { {'1','2','3','A'}, {'4','5','6','B'}, {'7','8','9','C'}, - {'*','0','#','D'}, -}; -byte rowPins[rows]={9,10,11,12}; -byte colPins[columns]={A0,A1,A2,A3}; -Keypad keypad = Keypad(makeKeymap(Keys),rowPins,colPins,rows,columns); -// with the arduino pin number it is connected to -LiquidCrystal lcd(2,3,4,5,6,7); -char str[4]={'1','2','3','4'}; + {'*','0','#','D'} + }; +byte rowPins[ROWS] = {A0,A1,A2,A3}; + byte colPins[COL] = {10,9,8,7}; +Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COL ); + void setup() { // set up the LCD's number of columns and rows: - lcd.begin(16, 0); + lcd.begin(16, 2); // Print a message to the LCD. - lcd.print("password"); - delay(1000); - lcd.clear(); + lcd.print("ENT PSSD"); +} + +void loop() { + + char key = keypad.getKey(); + if(keypressed) + Serial.println(keypressed); + if(key) + { + if( keypressed == '1' || keypressed == '2' || keypressed == '4' || keypressed == '5' ) + { + temp += keypressed; + lcd.print("1234"); + + }lcd.setCursor(0, 1); + lcd.print("wrong"); + + + + + } -int counter = 0 ; -void loop() -{ - char Key = keypad.getKey(); - if (Key == str[counter]) - counter++; - if(counter==4){ - lcd.setCursor(0,0); - lcd.print("Facebook : 123abc"); - } }