Hello
I have a big project that involve arduino, part of the project is to use keypad to input date and time.
I did manage to write a code for that but the serial monitor show only the date part and I can input the date, but after that the program does not continue to input the time.
** I am writing the code in the setup part because I want this to tun one time, then I am going to use arduino delay function later to keep tracking of the time.
Here is the code :
<-------------------------------------------------------------------------->
/*
- Note: in Keypad [#] is cosidered as / for date (day/mon/year) & - is cosidered as : for (hour:min)
- /
#include <Keypad.h>
const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{':','0','/'}
};
byte rowPins[ROWS] = {12, 7, 8, 10}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {11, 13, 9}; //connect to the column pinouts
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
char entryStr[8];
int l=0;
void setup(){
Serial.begin(9600);
int i=0;
int l=0;
// while (keypad.getKey()== NO_KEY){
if (i!=8) {
Serial.print("Date: ");
while (i!=8) {
char key2 = keypad.getKey();
if (key2 != NO_KEY){
entryStr*= key2;*
- i++;*
- Serial.print(key2);}*
- }*
- }*
- else {*
- if (l!=4) {*
- Serial.print("/n ");// New line*
- Serial.print("Time :");*
- while (l!=4) {*
- char key3 = keypad.getKey();*
- if (key3 != NO_KEY){*
- entryStr[l]= key3;*
- l++;*
- Serial.print(key3); }*
- }*
- }*
- }*
- }*
- void loop(){*
- }*
- <-------------------------------------------------------------------------->*
- I hope some body can help me figure the error in the code, because I can not put eye on the error.*