Made following changes to print from right to left.
unsigned long tempcount; // temporary count created by key entry
void getCount(const byte state, char key)
{
if (state == PRESSED)
{
if (getNumber)
{
// if not 5 characters yet
if (index < entryMaxSize)
{
// add key to userinput array and increment counter
if ( key >= '0' && key <= '9' ) // key is of type char and has a value between 0 and 9 so do something with it.
{
digits[index++] = key;
digits[index] = '\0';
tempcount = atol(digits);
char displayText[17] = "";
snprintf(displayText, sizeof(displayText), "Set Count: %5lu", tempcount);
lcd.setCursor(0, 0);
lcd.print(displayText);
}
}
else
{
countWarning();
}
}
}
}