Timer creation

Hey Guys,

I have been trying to create a fitness timer that can be set through the options displayed

For example,

An LCD can say,

What is your gender(2 options Given) → What type of workout(2 options Aerobic or anaerobic) → what is your age(4 Ranges are given) → What is your weight (4 Ranges are given)

Approximately 56 possibilities of times can be given.

In order to do this:

I would like to set up four pushbuttons that will respond to the user’s input.

How do I write a code for this (All I require is the code with just one or two if statement configuration, no need to do all of the combinations).

Please help me, this is a project for my University course.

Also, I am using a SparkFun LCD with RX, GN, and VD, I do not require specific commands with specific plug-in points.

Thank you (means a lot if you help me)

Here is the sample code for one option:

#include <SoftwareSerial.h>

#define txPin 2

SoftwareSerial LCD = SoftwareSerial(0, txPin);
// since the LCD does not send data back to the Arduino, we should only define the txPin
const int LCDdelay=10; // conservative, 2 actually works
int TestSwitchPin = 5;
int TestSwitchPin2= 6;

// wbp: goto with row & column
void lcdPosition(int row, int col) {
LCD.write(0xFE); //command flag
LCD.write((col + row*64 + 128)); //position
delay(LCDdelay);
}
void clearLCD(){
LCD.write(0xFE); //command flag
LCD.write(0x01); //clear command.
delay(LCDdelay);
}
void backlightOn() { //turns on the backlight
LCD.write(0x7C); //command flag for backlight stuff
LCD.write(157); //light level.
delay(LCDdelay);
}
void backlightOff(){ //turns off the backlight
LCD.write(0x7C); //command flag for backlight stuff
LCD.write(128); //light level for off.
delay(LCDdelay);
}
void serCommand(){ //a general function to call the command flag for issuing all other commands
LCD.write(0xFE);
}

void setup()
{
pinMode(TestSwitchPin, INPUT_PULLUP);
pinMode(txPin, OUTPUT);
LCD.begin(9600);
clearLCD();
lcdPosition(0,0);
LCD.print(“hello World”);
}

void loop()
{
if(digitalRead(TestSwitchPin) == LOW)
{
LCD.begin(9600);
clearLCD();
lcdPosition(0,0);
LCD.print(“hello World”);
}
if(digitalRead(TestSwitchPin) == LOW)
{
LCD.begin(9600);
clearLCD();
lcdPosition(0,0);
LCD.print(“hello no”);
if(digitalRead(TestSwitchPin2) == HIGH && (TestSwitchPin) == LOW)
{
LCD.begin(9600);
clearLCD();
lcdPosition(0,0);
LCD.print(“hello what”);
}
}
}

And yes, I will give cresit for those who have helped me

this is a project for my University course.

In your final report, will you give appropriate credit to the Arduino forum members who helped you?

Start with the Debounce example, so that you know how to handle buttons. Then advance to more sophisticated items.

You will need at least a fifth button - correction. And a sixth - reset. Probably more.

Anyway, do look into how to handle and read a button. Build your UI around that.

abioct2002:
I have been trying to create a fitness timer that can be set through the options displayed

Show us what you tried.