I was trying to limit the amount of code posted.
Here is all the code.
#include <Keypad.h>
int i;
char digitOneChar[2];
char digitTwoChar[2];
char digitThreeChar[2];
char digittogether[4];
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] = {9, 8, 7, 6}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {14, 15, 16}; //connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup(){
Serial.begin(9600);
i = 1;
}
void loop(){
char key = keypad.getKey();
char testStr[10];
int TestRnd;
char TotalNum[5];
if (key != NO_KEY){
Serial.println(key);
TestRnd = i;
sprintf(testStr, "i = %d", TestRnd);
Serial.println(testStr);
switch (i){
case 1:
sprintf(digitOneChar, "%d", key-48); i++;
Serial.println("First Digit");
Serial.println(digitOneChar);
break;
case 2:
sprintf(digitTwoChar, "%d", key-48); i++;
sprintf(digittogether, "%d%d", digitOneChar, digitTwoChar);
Serial.println(digitOneChar);
Serial.println(digitTwoChar);
// Serial.println(digittogether);
i = 1; //reset counter
break;
case 3:
delay(1000);
}
}
}
Thank you