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