#include "g.h"
#include "h.h"
#include <Keypad.h>
char x;
//copied code from custom keypad example from keypad.h//
const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {23, 22, 21, 19}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {18, 5, 4, 2}; //connect to the column pinouts of the keypad
//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);
//copy code 1 has ended//
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
//copied code from custom keypad example from keypad.h and further modified //
x = customKeypad.getKey();
if (x == '1'){ //As x is a char type value, single quotes are needed for comparison .thanks to u/suncoast_customs
Serial.println(x);
setup_g();
loop_g();
delay(2000);
}
if (x == '2'){
Serial.println(x);
setup_h();
loop_h();
}
//copy code 2 ended//
delay(20);
}