Two programs were built for this project, one that would output simple static text that doesn't change, and one that outputs text and scrolls in continously.
-Static LCD Text
-Scrolling LCD Text
The code seen below is pulled from the second theory section where we applied the basic code necessary to control the 16x2 LCD using the Arduino's LCD library functions.
16x2 Static LCD Text
------------« Begin Code »------------
// include the library code: #include// initialize the library with the numbers of the interface pins LiquidCrystal lcd(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); void setup() { // set up the LCD's number of columns and rows: lcd.begin(16, 2); // Print a message to the LCD. lcd.print("PyroElectro.com PyroElectro.com "); } void loop() { lcd.noBlink(); while(1){ } }
------------« End Code »------------
To take things a bit further, let's use one of the other more advanced functions and scroll the text one way forever. To make sure the screen doesn't scroll blank text in, the lcd output text string is lengthened and adds the text twice.
16x2 Scrolling LCD Text
------------« Begin Code »------------
// include the library code: #include// initialize the library with the numbers of the interface pins LiquidCrystal lcd(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); void setup() { // set up the LCD's number of columns and rows: lcd.begin(16, 2); // Print a message to the LCD. lcd.print("PyroElectro.com PyroElectro.com "); } void loop() { lcd.noBlink(); delay(1500); while(1){ lcd.scrollDisplayLeft(); delay(750); } }
------------« End Code »------------
Hopefully that didn't make you sweat too much and you're ready to see everything in action. Take your arduino, plug it in and program that thing with this code!