I am trying to promt the user to mak the first pick using the F1 and F2 buttons on this LCD shield. Then the user will be promt to make another choice based on the first selection using the 4 arrow keys. After the second choice is made, the LCD should display both choices together. Currently my code has two displays at the end, one for the F1 and one For the F2. What am I missing to make it only display the choice that was selected?
Also, is there away to make the second promt remain on screen until button is pressed. I use a delay to give time to read screen and press button?
// Define / Initiate Variables
char Key; // define the variable that will hold the button press
// the setup routine runs once when you press reset:
void setup()
{
// initialize Serial port and set baudrate at 4800 bps
Serial.begin(4800);
}
// the loop routine runs over and over again forever:
void loop()
{
Serial.write(1); // clear screen and home cursor
Serial.print("Thin (F1) Deep dish (F2)"); //prompt user
Key = Serial.read(); // wait for button press
delay (400);
if(Key=='5') // button 1 was pressed
{
Serial.write(1); // clear screen and home cursor - Deep Dish
Serial.print("S(^) M(>) L(V) XL(<)"); //prompt user
delay(2000);
}
if(Key=='1') // button 1 was pressed
{
Serial.write(1); // clear screen and home cursor
Serial.print("Small Deep Dish");
delay(2000);
}
if(Key=='2') // button 1 was pressed
{
Serial.write(1); // clear screen and home cursor
Serial.print("Medium Deep Dish");
delay(2000);
}
if(Key=='3') // button 1 was pressed
{
Serial.write(1); // clear screen and home cursor
Serial.print("Large Deep Dish");
delay(2000);
}
if(Key=='4') // button 1 was pressed
{
Serial.write(1); // clear screen and home cursor
Serial.print("Extra Large Deep Dish");
delay(2000);
}
if(Key=='6') // button 1 was pressed
{
Serial.write(1); // clear screen and home cursor - Think crust
Serial.print("S(^) M(>) L(V) XL(<)");
delay(2000);
}
if(Key=='1') // button 1 was pressed
{
Serial.write(1); // clear screen and home cursor
Serial.print("Small Thin");
delay(2000);
}
if(Key=='2') // button 1 was pressed
{
Serial.write(1); // clear screen and home cursor
Serial.print("Medium Thin");
delay(2000);
}
if(Key=='3') // button 1 was pressed
{
Serial.write(1); // clear screen and home cursor
Serial.print("Large Thin");
delay(2000);
}
if(Key=='4') // button 1 was pressed
{
Serial.write(1); // clear screen and home cursor
Serial.print("Extra Large Thin");
delay(2000);
}
}