Go Down

Topic: Scroll Text LCD Row 1 , no scroll text at Row 2 (Read 2149 times) previous topic - next topic

ArduinoPat

Nov 17, 2012, 06:41 pm Last Edit: Nov 17, 2012, 06:43 pm by ArduinoPat Reason: 1
Dear All,

Here my setup ; Arduino Uno , LCD  connected with the PCF8574A ( I2C )  



I have experiment with the follow sketch:
Code: [Select]
/*
 Scroll
 * this sketch scrolls text left when tilted
 * text scrolls right when not tilted.
*/

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

const int numRows = 2;
const int numCols = 16;

const char textString[] = "                  * ArduinoPat *      ";
const int textLen = sizeof(textString) -1;
boolean isTilted = false;
LiquidCrystal_I2C lcd(0x38,16,2);

void setup()
{
  lcd.init();
  lcd.backlight();
  lcd.begin(numCols, numRows);
  lcd.print(textString);
}

void loop()
{
 {
  for (int position = 0; position  < textLen; position++)
   {
     lcd.scrollDisplayLeft();
     delay(150);
   }
 }
 {
   for (int position = 0; position  < textLen; position++)
   {
     lcd.scrollDisplayRight();
     delay(150);
   }
 }
}
     
   



In Row one the text scrolls ( that's what i want )
But i will also put text at Row two, but whatever i try , this text will scroll either.

Maby some of you can give me a correct answer , the text will stay at Row two.

Many thanks for reading this topic


Regards ,

ArduinoPat
Patrick ,The Netherlands

PaulS

Quote
But i will also put text at Row two, but whatever i try , this text will scroll either.

That's what the scrollDisplayLeft() and scrollDisplayRight() methods do.

You want to emulate scrolling, by changing the message shown on line 1 each time through loop.

Show like so
Code: [Select]
Arduino is great
rduino is great A
duino is great Ar


It isn't that difficult to shift the array around. Even better, though, is to simply print two different parts of the one array each time. First, print 0 to n of the array and nothing. Then, print 1 to n and 0. Then 2 to n and 0 to 1. Then, 3 to n and 0 to 2. Keep this up until you are printing n and 0 to n-1. Next time, you start over.

Get rid of the unnecessary curly braces in loop.

ArduinoPat

Dear PaulS

Thanks for reply,

I want a text show at row 2 but without scroll effect,

Row 1 is scrolling text now , and that is what worked well now,

Maby you can show me an option to bring this at my sketch

Thanks,

ArduinoPat
Patrick ,The Netherlands

job_revi

#3
Jan 30, 2013, 08:07 am Last Edit: Jan 30, 2013, 08:09 am by job_revi Reason: 1
Code: [Select]

#include<LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);

String txtsc,txtnosc;
void setup(){
  txtnosc="Text No Scroll";
  txtsc="Text Scrolling  "
  lcd.begin(16, 2);
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print(txtnosc);
}

void loop(){

          lcd.setCursor(0,1);
           txtsc=ScrollTxt(txtsc);
           lcd.print(txtsc);
}

String ScrollTxt(String txt){
 return txt.substring(1,txt.length()) + txt.substring(0,1);
}


i hove this help  :smiley-mr-green:

"Semoga membantu"
Berbagi itu indah

Go Up