Modification to the Previous LCD Project

by Rookie P in Circuits > Arduino

1885 Views, 23 Favorites, 0 Comments

Modification to the Previous LCD Project

IMG_2017.JPG
LCD.jpg

After publishing the previous post, my friend told me there is an easier way with a 10k potentiometer, so I use the potentiometer included in the kit and follow his diagram and did the wiring.......

Wiring With Potentiometer

IMG_2018.JPG
IMG_2019.JPG
IMG_2020.JPG
IMG_2022.JPG

It works! Now I can turn the potentiometer to control the LCD!

I have also modify the code in Library a little bit. Here is the code:

// include the library code:

#include

// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {

// set up the LCD's number of columns and rows:

lcd.begin(16, 2);

// Print a message to the LCD.

lcd.setCursor(0,0);

lcd.print("Hey, pretty lady");

lcd.setCursor(0,1);

lcd.print("Go to see movie");

}

void loop() {

// Turn off the display:

lcd.noDisplay();

delay(500);

// Turn on the display:

lcd.display();

delay(500);

}

Downloads

Try to Make It Moves

IMG_2025.JPG

But the text is just limited to 16x2, which is definitely not enough for my "paragraph". : ) So I modify the code again referring to http://arduino.cc/en/Tutorial/LiquidCrystalScroll

// include the library code:

#include

// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {

// set up the LCD's number of columns and rows:

lcd.begin(16, 2);

// Print a message to the LCD.

lcd.setCursor(0,0);

lcd.print("Hey, pretty lady");

lcd.setCursor(0,1);

lcd.print("Go to see movie");

}

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 it 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);

}

It can move the whole text to left and right now.

Downloads

Make a Little Change Further

IMG_2055.JPG

Then I extent the text to a sentence and delete part of the code to let it moves to the left only. The final code is as follow:

// include the library code:

#include

// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {

// set up the LCD's number of columns and rows:

lcd.begin(16, 2);

// Print a message to the LCD.

lcd.setCursor(0,0);

lcd.print("Hey, pretty lady, let's go to see a");

lcd.setCursor(0,1);

lcd.print("movie and have a dinner tonite");

}

void loop() {

lcd.scrollDisplayLeft();

// wait a bit:

delay(150);

}

Finished! Next time I will start a new project with different stuffs. See you.

Downloads