Help with simple menu on Arduino + GLCD

I have setup my arduino mega 2560 with a adm12864h GLCD and a keypad and everything is working fine. The keypad goes from 0-9 with 2 other buttons and I can display each on my GLCD with no problem. Thing is I haven't found anywhere a simple menu that I can edit because all I need in my program is to display a splash screen until a button is pressed, then request input from keypad (display it as * characters) and record the keypad combination after the user hits enter, then do that all over again. I am SURE this is dead easy for anyone with programming skills but I have to have it finished in a few days and I am just asking for help. PLEASE!

1 Like

all I need in my program is to display a splash screen until a button is pressed, then request input from keypad (display it as * characters) and record the keypad combination after the user hits enter, then do that all over again.

Where does the menu come into play? A menu displays a list of choices that a user can make. I don't see your program offering the user a selection of choices.

How can I make my arduino, record the keypad sequence entered when the user inputs it and presses enter (E) for example.
I have a code here to get my keypad and GLCD started, I can make it show the numbers on the screen but I have NO IDEA how to make it work like a small sequence of: 1- SPLASH SCREEN, 2- INPUT SCREEN with * instead of numbers, 3- GOOD BYE SCREEN. And repeat over and over and at the input screen record the 4 digit sequence entered. PLEASE I AM SO SURE THIS IS VERY EASY FOR ANYONE WITH THE LEAST AMOUNT OF PROGRAMMING SKILLS, I’m desperate! :frowning:

 #include <glcd.h>
#include <Keypad.h>
#include <fonts/allfonts.h>
#include <EEPROM.h>

int led = 13;
const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'C','0','E'}
};
byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){
  pinMode(led, OUTPUT);
  GLCD.Init();
  GLCD.SelectFont(Arial14);
}
  
void loop(){
  int val = analogRead(0) / 4;
  char key = keypad.getKey();
  if (key){
    GLCD.print(key);}
    if (key == 'C'){digitalWrite(led, HIGH); GLCD.ClearScreen();}
    if (key == 'E'){digitalWrite(led, LOW);
    }
  
}
1 Like

How can I make my arduino, record the keypad sequence entered when the user inputs it and presses enter (E) for example.
I have a code here to get my keypad and GLCD started, I can make it show the numbers on the screen but I have NO IDEA how to make it work like a small sequence of: 1- SPLASH SCREEN, 2- INPUT SCREEN with * instead of numbers, 3- GOOD BYE SCREEN. And repeat over and over and at the input screen record the 4 digit sequence entered. PLEASE I AM SO SURE THIS IS VERY EASY FOR ANYONE WITH THE LEAST AMOUNT OF PROGRAMMING SKILLS, I’m desperate! :frowning:

 #include <glcd.h>
#include <Keypad.h>
#include <fonts/allfonts.h>
#include <EEPROM.h>

int led = 13;
const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'C','0','E'}
};
byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){
  pinMode(led, OUTPUT);
  GLCD.Init();
  GLCD.SelectFont(Arial14);
}
  
void loop(){
  int val = analogRead(0) / 4;
  char key = keypad.getKey();
  if (key){
    GLCD.print(key);}
    if (key == 'C'){digitalWrite(led, HIGH); GLCD.ClearScreen();}
    if (key == 'E'){digitalWrite(led, LOW);
    }
  
}

How can I make my arduino, record the keypad sequence entered when the user inputs it and presses enter (E) for example.

EEPROM is for data that needs to persist after the Arduino is rebooted. I fail to see how keypad entry data fits this criteria.

PLEASE I AM SO SURE THIS IS VERY EASY FOR ANYONE WITH THE LEAST AMOUNT OF PROGRAMMING SKILLS

It is, but isn't the point for you to acquire said programmign skills? If not, head over to Gigs and Collaboration and offer to pay.

Assuming that the user will always enter 4 characters, no more and no less, before pressing the E key is your first mistake. Or second, depending on when you made that one versus the EEPROM one.

If you can see that a key is pressed, I fail to see why you can't store it in an array. Well, except for that fact that you haven't declared such an array, or an index into the array, or written any code to do the work.

Don't start another thread.

Please do not cross-post. This wastes time and resources as people attempt to answer your question on multiple threads.

Threads merged.

  • Moderator

If you are trying to get somebody else to write this for you, then you should post in the Gigs and Collaborations thread. If you are wanting to learn to do this yourself, then you are wanting to learn about a variable called an array. You can save a series of keypresses as an array by first assigning a character to the keypress, adding that character to the array, and then adding another digit to the array that waits to be filled by the next keypress. If/when you read the array, you can look for an ascii 0(48), which is nothing, to tell you that you have hit the end of the string. You may find this tutorial helpful: http://arduino.cc/en/Tutorial/Array The sketch in the tutorial is also in the arduino examples folder.