Hello everyone,
(I do not know if I published in the good section)
Being a beginner with Arduino, I started learning to use LCD screen.
Following tutorials I learned to just display a text, make it blink .. (for 16x1 since I have only that for the moment).
However, I try for a few days to scroll my text from left to right and from right to left but I only fall on tutos for 16x2, so I simply copied pasted the code that is on this site to try to to change two things so that the text scrolls correctly but without success, the text is cut in half and scrolls in offset.
So I would like an explanation to be able to scroll correctly on my 16x1.
Here is the code I use but which is obviously not the right one to scroll on a 16x1:
#include <LiquidCrystal.h> // we import the library
LiquidCrystal lcd (12,11,5,4,3,2); // create the screen object
void setup () {
// set up the LCD's number of columns and rows:
// A 1x16 Line display is addressed as 2x8
lcd.begin (8, 2);
// Print a message to the LCD.
lcd.print ("Hello a");
// Move the cursor to the beginning of the second address block
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor (0, 1);
lcd.print ("all!");
}
void loop () {
// scroll 13 positions (string length) to the left
// to move it offscreen left:
for (int positionCounter = 0; positionCounter <13; positionCounter ++) {
// scroll one position left:
lcd.scrollDisplayLeft ();
// wait a bit:
delay (150);
}
// scroll 29 positions (string length + display length) to the right
// to move it offscreen right:
for (int positionCounter = 0; positionCounter <29; positionCounter ++) {
// scroll one position right:
lcd.scrollDisplayRight ();
// wait a bit:
delay (150);
}
// scroll 16 positions (display length + string length) to the left
// to move back to center:
for (int positionCounter = 0; positionCounter <16; positionCounter ++) {
// scroll one position left:
lcd.scrollDisplayLeft ();
// wait a bit:
delay (150);
}
// delay at the end of the full loop:
delay (1000);
}
Hoping to have been clear in my post,
Thank you.