#include <Adafruit_GFX.h> //
#include <Adafruit_ST7789.h> //LCD Display lib 
#include <SPI.h> //
#include <Keypad.h> //Keypad lib

using namespace std;

//KeyPad Init..
const byte ROWS = 4; 
const byte COLS = 4;
char hexaKeys[ROWS][COLS] = 
{
  {'1', '2', '3', 'A'},
  {'4', '5', '6', 'B'},
  {'7', '8', '9', 'C'},
  {'*', '0', '#', 'D'}
};

byte rowPins[ROWS] = {12, 14, 27, 26}; 
byte colPins[COLS] = {25, 33, 32, 35}; 

Keypad customKeypad = Keypad(makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);

//Dispay Init..
#define CS    5
#define RST   15
#define DC    4   
#define MOSI  23  //DIN
#define SCLK  18  //CLK
#define MISO  19  //BL

Adafruit_ST7789 LCD = Adafruit_ST7789(CS, DC, RST);


void setup() 
{
  Serial.begin(9600);
  LCD.init(240, 320);
  LCD.setRotation(1);
  LCD.fillScreen(ST77XX_BLACK);
  LCD.setTextColor(ST77XX_GREEN);
  LCD.setTextSize(3);
  LCD.setCursor(0, 0);
  LCD.println("Welcome to General Election!!");
  
}

void loop()
{
delay(1000);
}

void loop1() 
{
  LCD.fillScreen(ST77XX_BLACK);
  LCD.setCursor(0, 0);
  LCD.println("Welcome to General Election!!");
  LCD.println("Please enter '#' to start..");

  char startKey = customKeypad.getKey();
  if(startKey == '#')
  {
    Start:
    LCD.fillScreen(ST77XX_BLACK);
    LCD.println("Enter user ID number and press '#'");

    string idNumber = "";
    char idNumberKey = customKeypad.getKey();
    while(idNumberKey == '#' )
    {
      if(idNumberKey != '\0')
        idNumber += idNumberKey;
        LCD.print(idNumberKey);
    }

    //call validate id 
    if(VerifyID(idNumber))
    {
      goto Start;
    }

    

    //LCD.fillScreen(ST77XX_BLACK);
    //LCD.println("Enter user ID number and press '#'");


  }

    
    
    

 // char customKey = customKeypad.getKey();
 // if (customKey != '\0' )
 // {
   // LCD.fillScreen(ST77XX_BLACK);
   // LCD.setTextColor(ST77XX_WHITE);
   // LCD.setTextSize(5);
   // LCD.setCursor(0, 0);
   // LCD.println(customKey);

    // Clear customKey
   // customKey = '\0';

    //Serial.println(customKey);
  //}

  delay(50);

}

bool VerifyID(string id)
{

  return true;
}

bool VerifyPostCode()
{

  return true;
}

void StoreVote()
{

}
$abcdeabcde151015202530fghijfghij
$abcdeabcde151015202530fghijfghij