Best way to make this scroll (second line of lcd only)...

I have this clock and wish for it to scroll the bottom line to scroll without interrupting the clock time
ATM it just changes between the three lines of info ie
CLOCK
DAY
then
CLOCK
MONTH
then
CLOCK
YEAR
and repeats and i wish for it to go
Wednesday OCTOBER 19 2011 and scroll that across the lcd then just loop it back and forth…
so at startup you would see
Wendsday Octob
then later
October 19 2011 then it reverses back to the other
here is the “base” code…

#include <Time.h>  
#define TIME_MSG_LEN  11   
#define TIME_HEADER  'T'   
#define TIME_REQUEST  7    
int houradjust = 0;
int foo = 1;
#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
void setup() { 
  Serial.begin(9600);
  setTime(15,55,00,19,10,2011);
  lcd.begin(16, 2);
  setSyncProvider( requestSync);
  lcd.print("Please Sync <3");
}

void loop(){    
  if(Serial.available() ) 
  {
    processSyncMessage();
  }
  if(timeStatus()!= timeNotSet) 
  {
    digitalClockDisplay();  
  }
  delay(100);
}

void digitalClockDisplay(){
  delay(5);
  lcd.clear();

  if (foo == 1) {
    derp();
    
  }
    else if (foo == 3){
    AL2();
  }
 else if (foo == 2){
    AL1();
  }


  if (isPM())
  {
    if (hour() != 12)
    { 
      houradjust = hour()-12;
    }
  }
  if (isAM())
  {
    houradjust = hour();
  }
  lcd.print(houradjust);
  lcd.print(":");
  lcd.print(minute());
  lcd.print(":");
  lcd.print(second());
  if (isAM()){
    lcd.print(" A.M.");
  }
  if (isPM()){
    lcd.print(" P.M.");
  }


}
void printDigits(int digits){
  // utility function for digital clock display: prints preceding colon and leading 0
  Serial.print(":");
  if(digits < 10)
    Serial.print('0');
  Serial.print(digits);
}
void derp() {
  lcd.clear();
  lcd.setCursor(0,1);
  lcd.print(dayStr(weekday()));
  foo = 2;
  lcd.setCursor(0,0);
  
}


void AL1() {
  lcd.clear();
  lcd.setCursor(0,1);
  lcd.print(monthStr(month()));
  lcd.print( " ");
  lcd.print(day());
  foo = 3;
  lcd.setCursor(0,0);
}


void AL2(){
  lcd.clear();
  lcd.setCursor(0,1);
  lcd.print(year());
  foo = 1;
  lcd.setCursor(0,0);
}

void processSyncMessage() {
  // if time sync available from serial port, update time and return true
  while(Serial.available() >=  TIME_MSG_LEN ){  // time message consists of a header and ten ascii digits
    char c = Serial.read() ; 
    Serial.print(c);  
    if( c == TIME_HEADER ) {       
      time_t pctime = 0;
      for(int i=0; i < TIME_MSG_LEN -1; i++){   
        c = Serial.read();          
        if( c >= '0' && c <= '9'){   
          pctime = (10 * pctime) + (c - '0') ; // convert digits to a number    
        }
      }   
      setTime(pctime);   // Sync Arduino clock to the time received on the serial port
    }  
  }
}

time_t requestSync()
{
  Serial.print(TIME_REQUEST,BYTE);  
  return 0; // the time will be sent later in response to serial mesg
}

Thanks… I really don’t know how to do this

Please help...

I have this clock and wish for it to scroll the bottom line to scroll without interrupting the clock time

This has been covered before (http://arduino.cc/forum/index.php/topic,44953.0.html) but it's not too easy to find unless you are lucky with your search terms.

The HD44780 cannot inherently scroll one line without the other. One way to accomplish this is to scroll both lines and then rewrite the "fixed" line.

Don

So ... I will have to run my function then have a seperate function to fix the top line ex...

clock() bottom() repeat until the bottom reaches the end then loop it back again...

New question... this is going to be noobish... how would I define something as a word...

DSE = "BLAH" what would go before DSE?

char DSE[] = {"BLAH"};

or

char *DSE = "BLAH";

First, create an array of characters that is large enough, and update it every second/minute.

 char s[50];
 s="name of day HH:MM MM DD YYY";

Second, use a pointer to character. This will show where we need to start displaying. Update it how often you like to. It’s value will go from ‘s’ to ‘s+strlen(s)-21’.

 char s[50];
 s="name of day HH:MM MM DD YYY"; 

char *p; 
for( ; ; ){
  int i;
  for( i=0; i<strlen(s)-20; i++ ){
    p=s+i;
    delay(100);//shift string period
  }
}

Third, use array of characters, only 20 characters this time.

use strncpy http://www.cplusplus.com/reference/clibrary/cstring/strncpy/

char s[50];
s="name of day HH:MM MM DD YYY"; 
char display[21];


char *p; 
for( ; ; ){
  int i;
  for( i=0; i<strlen(s)-20; i++ ){
    p=s+i;
    strncpy(display,p,20);
    lcd.print(display);
    //may update s here
    delay(100);//shift string period
  }
  i=0;
}

I didn’t test it, there may be errors. Hope this helps.

If I use the functions to get names will that work

char s[50];
s = dayShortStr(weekday()),monthShortStr(month(),year()

Awsomdk:
If I use the functions to get names will that work

char s[50];

s = dayShortStr(weekday()),monthShortStr(month(),year()

I haven’t used such a function before. But if it is in a C/C++ library, probably it will.

By the way you’ll need to use either + operator or strcat() function to concatenate strings.

Okay with a similar style to the code you gave me i get this error

Cursor:18: error: invalid conversion from 'char*' to 'char' Cursor:19: error: invalid conversion from 'char*' to 'char'

with this code

  char DAY[] = {dayShortStr(weekday())};
  char MONTH[] = {monthShortStr(month())};
  char S[] = {second()};
  char M[] = {minute()};
  char H[] = {hour()}

Nevermind forgot to make those strings... derp