Need help changing code for linear keypad instead of matrixr

Hi. Working on a series of projects for a Maker Faire and running out of time. Idea is to give people a free Uno, have them upload some code, then have them attach a pre-made project so they can see the results.

My problem is the project I plan to use has code for a Matrix keypad, and I have a linear keypad.

The code was set up to use the #keypad library, with debounce functions, etc.

So, I need to change the code to work with the linear keypad instead, if possible. I’m not sure if the keypad library even supports a linear keypad. I have all the Arduino pins available, it is just trying to use the library that has me stumped.

Any help would be GREATLY appreciated, I just don’t have much time left to figure this out…

existing CODE

#include <Keypad.h>

char* secretCode = “1234”;

int position = 0;

const byte rows = 4;

const byte cols = 3;

char keys[rows][cols] = {

{‘1’,‘2’,‘3’},

{‘4’,‘5’,‘6’},

{‘7’,‘8’,‘9’},

{‘*’,‘0’,‘#’}

};

byte rowPins[rows] = {2, 7, 6, 4};

byte colPins[cols] = {3, 1, 5};

Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, rows, cols);

int redPin = 9;

int greenPin = 8;

void setup()

{

pinMode(redPin, OUTPUT);

pinMode(greenPin, OUTPUT);

setLocked(true);

}

void loop()

{

char key = keypad.getKey();

if (key == ‘*’ || key == ‘#’)

{

position = 0;

setLocked(true);

}

if (key == secretCode[position])

{

position ++;

}

if (position == 4)

{

setLocked(false);

}

delay(100);

}

void setLocked(int locked)

{

if (locked)

{

digitalWrite(redPin, HIGH);

digitalWrite(greenPin, LOW);

}

else

{

digitalWrite(redPin, LOW);

digitalWrite(greenPin, HIGH);

}

}