Saving number keypad

Hello guys!
I will need some help from you.
I wrote program for my “football substitution board” that have four 7LED segment displays. But got a problem with numbers over 9. So I think I will need program like this: 1. press any number from 0-9 (exc. if no. 1 is pressed pins 1,2,3,5 2 are high) 2. press # (to enter and go to te next 7 led segment) 3. press any number from 0-9 4. press # 5. press any number from 0-9 6. press # 7. …

I do not have this knowledge to make program like this. So i am asking you for some help.

this is my current program:

#include <Keypad.h>

const byte numRows= 4;
const byte numCols= 4;

//keymap defines the key pressed according to the row and columns just as appears on the keypad
char keymap[numRows][numCols]=
{
{'1', '2', '3', 'A'},
{'4', '5', '6', 'B'},
{'7', '8', '9', 'C'},
{'*', '0', '#', '+'}
};

byte rowPins[numRows] = {13,12,11,10}; //Rows 0 to 4
byte colPins[numCols]= {9,8,7,6}; //Columns 0 to 4

//initializes an instance of the Keypad class
Keypad myKeypad= Keypad(makeKeymap(keymap), rowPins, colPins, numRows, numCols);
#define lr1 14// red
#define lr2 15
#define lr3 16
#define lr4 17
#define lr5 18
#define lr6 19
#define lr7 20
#define lr8 21
#define lr9 22
#define lr10 23
#define lr11 24
#define lr12 25
#define lr13 26
#define lr14 27
#define lz1 28 // green
#define lz2 29
#define lz3 30
#define lz4 31
#define lz5 32
#define lz6 33
#define lz7 34
#define lz8 35
#define lz9 36
#define lz10 37
#define lz11 38
#define lz12 39
#define lz13 40
#define lz14 41
void setup()
{
pinMode(lr1, OUTPUT);
pinMode(lr2, OUTPUT);
pinMode(lr3, OUTPUT);
pinMode(lr4, OUTPUT);
pinMode(lr5, OUTPUT);
pinMode(lr6, OUTPUT);
pinMode(lr7, OUTPUT);
pinMode(lr8, OUTPUT);
pinMode(lr9, OUTPUT);
pinMode(lr10, OUTPUT);
pinMode(lr11, OUTPUT);
pinMode(lr12, OUTPUT);
pinMode(lr13, OUTPUT);
pinMode(lr14, OUTPUT);
pinMode(lz1, OUTPUT);
pinMode(lz2, OUTPUT);
pinMode(lz3, OUTPUT);
pinMode(lz4, OUTPUT);
pinMode(lz5, OUTPUT);
pinMode(lz6, OUTPUT);
pinMode(lz7, OUTPUT);
pinMode(lz8, OUTPUT);
pinMode(lz9, OUTPUT);
pinMode(lz10, OUTPUT);
pinMode(lz11, OUTPUT);
pinMode(lz12, OUTPUT);
pinMode(lz13, OUTPUT);
pinMode(lz14, OUTPUT);
digitalWrite(lr1,LOW);
digitalWrite(lr2,LOW);
digitalWrite(lr3, LOW);
digitalWrite(lr4, LOW);
digitalWrite(lr5, LOW);
digitalWrite(lr6, LOW);
digitalWrite(lr7, LOW);
digitalWrite(lr8, LOW);
digitalWrite(lr9, LOW);
digitalWrite(lr10, LOW);
digitalWrite(lr11, LOW);
digitalWrite(lr12, LOW);
digitalWrite(lr13, LOW);
digitalWrite(lr14, LOW);
digitalWrite(lz1, LOW);
digitalWrite(lz2, LOW);
digitalWrite(lz3, LOW);
digitalWrite(lz4, LOW);
digitalWrite(lz5, LOW);
digitalWrite(lz6, LOW);
digitalWrite(lz7, LOW);
digitalWrite(lz8, LOW);
digitalWrite(lz9, LOW);
digitalWrite(lz10, LOW);
digitalWrite(lz11, LOW);
digitalWrite(lz12, LOW);
digitalWrite(lz13, LOW);
digitalWrite(lz14, LOW);
Serial.begin(9600);
}


void loop()
{
char keypressed = myKeypad.getKey();
if (keypressed != NO_KEY)
{
switch (keypressed)
{
  case '*':
digitalWrite(lr1,LOW);
digitalWrite(lr2,LOW);
digitalWrite(lr3, LOW);
digitalWrite(lr4, LOW);
digitalWrite(lr5, LOW);
digitalWrite(lr6, LOW);
digitalWrite(lr7, LOW);
  break;
  case '0':
digitalWrite(lr1,LOW);
digitalWrite(lr2,LOW);
digitalWrite(lr3, LOW);
digitalWrite(lr4, LOW);
digitalWrite(lr5, LOW);
digitalWrite(lr6, LOW);
  break;
  case '1':
  digitalWrite(lr2, HIGH);
  digitalWrite(lr3, HIGH);
  break;
  case '2':
  digitalWrite(lr1, HIGH);
  digitalWrite(lr2, HIGH);
  digitalWrite(lr7, HIGH);
  digitalWrite(lr5, HIGH);
  digitalWrite(lr4, HIGH);
  break;
    case '3':
  digitalWrite(lr1, HIGH);
  digitalWrite(lr2, HIGH);
  digitalWrite(lr7, HIGH);
  digitalWrite(lr3, HIGH);
  digitalWrite(lr4, HIGH);
  break;
    case '4':
  digitalWrite(lr6, HIGH);
  digitalWrite(lr7, HIGH);
  digitalWrite(lr2, HIGH);
  digitalWrite(lr3, HIGH);
  break;
    case '5':
  digitalWrite(lr1, HIGH);
  digitalWrite(lr6, HIGH);
  digitalWrite(lr7, HIGH);
  digitalWrite(lr3, HIGH);
  digitalWrite(lr4, HIGH);
  break;
    case '6':
  digitalWrite(lr1, HIGH);
  digitalWrite(lr5, HIGH);
  digitalWrite(lr7, HIGH);
  digitalWrite(lr3, HIGH);
  digitalWrite(lr4, HIGH);
  digitalWrite(lr6, HIGH);
  break;
    case '7':
  digitalWrite(lr1, HIGH);
  digitalWrite(lr2, HIGH);
  digitalWrite(lr3, HIGH);
  break;
    case '8':
  digitalWrite(lr1, HIGH);
  digitalWrite(lr2, HIGH);
  digitalWrite(lr3, HIGH);
  digitalWrite(lr4, HIGH);
  digitalWrite(lr5, HIGH);
  digitalWrite(lr6, HIGH);
  digitalWrite(lr7, HIGH);
  break;
    case '9':
  digitalWrite(lr1, HIGH);
  digitalWrite(lr2, HIGH);
  digitalWrite(lr7, HIGH);
  digitalWrite(lr3, HIGH);
  digitalWrite(lr4, HIGH);
  digitalWrite(lr6, HIGH);
  break;
  default:
  Serial.print(keypressed);
}
}
}

tipkovnica.ino (4.08 KB)

Please edit your post to use code tags. See How to use this forum. Without it your post is just unreadable.

that's much better :slight_smile: