Hello,
I'm trying to add a character to a character array depending on what key is pressed on my keypad. The keypad input code works just fine, the problem for me is adding the character input from the keypad to my character array.
Below is my code:
int i;
char Attempt[17];
void loop(){
char key = keypad.getKey();
if (i >=15){
Serial.println("Limit Reached");
} else{
if (key != NO_KEY){
Serial.println("Key Pressed: ");
Serial.println(key);
Attempt[i] = key;
i += i;
Serial.println("Array so far: ");
Serial.println(Attempt);
}
}
}
I think I've narrowed my problem down to i not increasing when a new key is pressed based on the sierial monitor.
Below is some of the serial monitor output when I press 1, 2, and 3 on the keypad:
Key Pressed:
1
Array so far:
1
Key Pressed:
2
Array so far:
2
Key Pressed:
3
Array so far:
3
Please Let me know if you need more information or if you have answers or advice.