Modification to the Previous LCD Project
by Rookie P in Circuits > Arduino
1895 Views, 23 Favorites, 0 Comments
Modification to the Previous LCD Project
![IMG_2017.JPG](/proxy/?url=https://content.instructables.com/FGP/4RD8/HWLD0K3K/FGP4RD8HWLD0K3K.jpg&filename=IMG_2017.JPG)
![LCD.jpg](/proxy/?url=https://content.instructables.com/FRW/O3L5/HWLD0KIU/FRWO3L5HWLD0KIU.jpg&filename=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](/proxy/?url=https://content.instructables.com/F8I/OG89/HWLD0K5D/F8IOG89HWLD0K5D.jpg&filename=IMG_2018.JPG)
![IMG_2019.JPG](/proxy/?url=https://content.instructables.com/FIC/3FU4/HWLD0KCR/FIC3FU4HWLD0KCR.jpg&filename=IMG_2019.JPG)
![IMG_2020.JPG](/proxy/?url=https://content.instructables.com/F64/021V/HWLD0KDX/F64021VHWLD0KDX.jpg&filename=IMG_2020.JPG)
![IMG_2022.JPG](/proxy/?url=https://content.instructables.com/F6R/M8KX/HWLD0KF4/F6RM8KXHWLD0KF4.jpg&filename=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](/proxy/?url=https://content.instructables.com/FHN/FDAJ/HWLD0KGK/FHNFDAJHWLD0KGK.jpg&filename=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](/proxy/?url=https://content.instructables.com/FIA/2KJZ/HWLD0KHP/FIA2KJZHWLD0KHP.jpg&filename=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.