I am trying to program my ESP 32 so that when I press a few buttons I can enter the ssid and pass of a wifi network. I want to use one button to go forward in the alphanumerics one to go back and one for capitalization. The final button is for saving each successive letter/number.
The code I have written so far is as follows:
#define IO14_BTN 14
#define IO27_BTN 27
#define IO19_BTN 19
#define IO0_BTN 0
char * AN = "abcdefghijklmnopqrstuvwxyz0123456789";
char * ANC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
void setup() {
Serial.begin(115200);
pinMode(IO14_BTN, INPUT_PULLUP);
pinMode(IO27_BTN, INPUT_PULLUP);
pinMode(IO19_BTN, INPUT_PULLUP);
pinMode(IO0_BTN, INPUT_PULLUP);
}
void loop() {
Serial.println("Begining Entry.");
int count = 0;
int wlen = 0;
bool isCap = false;
char * word[15];
char let = 'a';
while (1) {
if(digitalRead(IO19_BTN) == LOW){
count ++;
if (count == 36){
count = 0;
}
let = AN[count];
delay(100);
}
if(digitalRead(IO14_BTN) == LOW){
count --;
if (count == -1){
count = 35;
}
let = AN[count];
delay(100);
}
if(digitalRead(IO27_BTN) == LOW){
if(!isCap) {
let = ANC[count];
isCap = true;
} else {
let = AN[count];
isCap = false;
}
delay(100);
}
if(digitalRead(IO0_BTN) == LOW){
Serial.println("Saving letter.");
if(wlen <= 15){
word[1] + let;
wlen ++;
} else {
Serial.println("Char limit reached.");
}
delay(100);
}
Serial.println("SSID:");
Serial.print(word[1]);
Serial.println(let);
delay(100);
}
}
This code works for scrolling forwards and back through the letters and numbers and also for capitalization of the letters but when I press IO0_BTN to try and save it the letter seems to not save into the char* word[15], I'm not sure what I'm doing wrong as I am quite new to this and any help would be much appreciated. If this is poorly explained and anyone needs any clarification I'm happy to offer it.