Pages: [1]   Go Down
Author Topic: Scroll Text LCD Row 1 , no scroll text at Row 2  (Read 1849 times)
0 Members and 1 Guest are viewing this topic.
Netherlands
Offline Offline
Jr. Member
**
Karma: 1
Posts: 53
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Dear All,

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



I have experiment with the follow sketch:
Code:
/*
  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
« Last Edit: November 17, 2012, 12:43:25 pm by ArduinoPat » Logged

Patrick ,The Netherlands

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 638
Posts: 50306
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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.
Logged

Netherlands
Offline Offline
Jr. Member
**
Karma: 1
Posts: 53
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Patrick ,The Netherlands

Indonesia, Bandung
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
#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"
« Last Edit: January 30, 2013, 02:09:10 am by job_revi » Logged

Berbagi itu indah

Pages: [1]   Go Up
Jump to: