AdaFruit LCD Shield with Buttons

I'm using the AdaFruit LCD Shield that has the Left, Right, Up, Down, Select and Reset Buttons and I'm stumped.

When a button is pressed as in the Hello World Example it holds the text on the display of the last button pressed. I can't figure out for the life of me how to press any one of the Buttons and have my code go on to another task.

Example: If I press the Down Button I want my initial welcome screen to change to "Start In" and on the second line a count down timer from say 10 down to 0 Seconds. I then want the rest of my code to execute and have the capability to pause it by pressing one of the other buttons. If I press the Down Button again the countdown timer will again run before going on.

All I can get it to do is display "Start In" and a countdown timer that is only updated each time I press the Down Button. I have also not been able to use any conditional statements as well to move on when 0 is reached in the countdown.

I know this is a stupid question but I'm newer than a new born baby and it's got me stumped. Most of my other code is built and far more complex than this but as I say I'm stuck on this one.

Thanks

It is not a stupid question but you won't get any help until you lift the veil of secrecy from your code.

Ok here’s my initial code but I can’t get any of the Button Functions and Countdown timer to work now.

#include <Wire.h>
#include <Adafruit_RGBLCDShield.h>
#include <utility/Adafruit_MCP23017.h>
Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();

const int VoltInPin = 15;
const int TempHVoltOut = 53;          //Delete when Current Sensor is used.
unsigned long LastActionTimeA = 0;
unsigned long RunMillis = 0;
unsigned long RunMillisDown = 0;
unsigned long AllSecondsUp = 0;
unsigned long RunTimeUp = 0;
unsigned long AllSecondsDown = 0;
int RunHoursUp = 0;
int RunHoursDown = 0;
int SecsRemainingUp = 0;
int SecsRemainingDown = 0;
int RunMinutesUp = 0;
int RunMinutesDown = 0;
int RunSecondsUp = 0;
int RunSecondsDown = 0;
float InputVolts = 0.0;
float InputAmps = 0.0;
int AnalogValue = 0;
int Samples = 0;
float TotalAmps = 0.0;
float AverageAmps = 0.0;
float AmpMillis = 0.0;
float AmpHours = 0.0;
float Temp = 0.0;
unsigned long CurrentSeconds = 0;
unsigned long CountDownSeconds = 10;
void setup()
{
  lcd.begin(16, 2);
  LastActionTimeA = millis();
  pinMode(VoltInPin, INPUT);
  pinMode(TempHVoltOut, OUTPUT);            //Delete when Current Sensor added
  digitalWrite(TempHVoltOut, HIGH);         //Delete when Current Sensor added
  lcd.clear();
  lcd.print("Connect Battery");
  lcd.setCursor(0 ,1);
  lcd.print("and Press Start");

}

int TimerA = 200;
uint8_t i=0;

void loop()
{
  RunMillis = millis();

  uint8_t buttons = lcd.readButtons();

  if (buttons)
  {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Start In");
    if (buttons & BUTTON_DOWN)
  {
      if (CountDownSeconds > 0)
  }
      CountDownSeconds = 10 - (millis() / 1000);
      lcd.setCursor(0, 1);
      lcd.print(CountDownSeconds);
  }
    { //Count Up Timer
      
      AllSecondsUp = millis() / 1000;
      RunHoursUp = AllSecondsUp / 3600;
      SecsRemainingUp = AllSecondsUp % 3600;
      RunMinutesUp = SecsRemainingUp / 60;
      RunSecondsUp = SecsRemainingUp % 60;

      char buf[8];
      sprintf(buf, "%02d:%02d:%02d", RunHoursUp, RunMinutesUp, RunSecondsUp);
      lcd.setCursor(0, 0);
      lcd.print(buf);
      lcd.print("   ");
    }
}

As I'm very new to this I'm pulling what I can from anyone and everyone.

I have taken the AdaFruit Hello World Sketch as an example and tried to implement in it what I'm looking for without any luck.

I don't really understand in that Sketch how to make a button trigger an action and go on. It seems to hold the last pressed button forever and I'm not sure how to make the Library continue after pressing one of the buttons.

I would also like to the list of the Keywords for their Libraries and how to use them.

Have you tried asking the Adafruit people? Adafruit forums They're usually pretty helpful and understand their products quite well.

-jim lee