Small code should be posted in the post, not as attachment. You will get a lot more audience because ino files can't be opened on cell phones.
moshiko's code
/* this program shows how to write long text messages on LCD by scrolling*/
// define the chars in one LED line
#define LEDLINE 16
#include <LiquidCrystal_I2C.h>
#include <Wire.h> // Comes with Arduino IDE, needed for I2C communication
/*
* I2C interface card for LCD, 16 chars 2 line display
* I2C interface card connection: GND, Vcc 5v, SDA to pin A4, SCL to pin A5
* LCD_I2c adrees 0x3F
*/
// addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address
// define scrolling speed for two LED lines
const int ledScrollSpeed[2]={445,450};
// define scrolling direction for two LED lines (true means right-to-left scrolling)
const boolean ledScrollDir[2]={true,true};
/////////// function to check position of the character //////////////
char charAt(char *text, int pos)
// scrolling-logic coded here
{
if (pos<LEDLINE) return ' '; // scroll in
else if (pos>=LEDLINE && pos<LEDLINE+strlen(text))
return text[pos-LEDLINE]; // scroll text
else return ' '; // scroll out
}
////////////////////////////////////////////////
/* this function scrolles the test on top or botoom line on the LCD
* according to the line parameter
*/
void scroll_text(char *text, byte line)
// scroll the LED lines
{
long endScrool=millis()+5000; //test
char currenttext[LEDLINE+1];
static unsigned long nextscroll[2];
static int positionCounter[2];
int i;
if (millis()>nextscroll[line])
{
nextscroll[line]=millis()+ledScrollSpeed[line];
for (i=0;i<LEDLINE;i++)
currenttext[i]=charAt(text,positionCounter[line]+i);
currenttext[LEDLINE]=0;
lcd.setCursor(0,line);
lcd.print(currenttext);
if (ledScrollDir[line])
{
positionCounter[line]++;
if (positionCounter[line]==strlen(text)+LEDLINE) positionCounter[line]=0;
}
else
{
positionCounter[line]--;
if (positionCounter[line]<0) positionCounter[line]=strlen(text)+LEDLINE-1;
}
}
}
/////////// end of function /////////////////////////////////////////////////
void setup() {
// put your setup code here, to run once:
lcd.begin(16,2);
}
void loop() {
// Scroll text in line number 0
scroll_text("This text is for top line, it is long ",0);
// Scroll text in line number 1
scroll_text("This on bottom",1);
// after finish the entire text display i want to continue with code, how?
}
Keep a counter; when the counter reaches a specified number of 'scrolls', you continue with the rest of the program.
Something like
void loop()
{
// variable to count number of 'scrolls'; by default initialised to 0
static byte scrollCount;
if(scrollCount < 5 )
{
scrollCount++;
// Scroll text in line number 0
scroll_text("This text is for top line, it is long ",0);
// Scroll text in line number 1
scroll_text("This on bottom",1);
// nothing else to do
return;
}
}