Tuesday, November 14, 2017

16X2 LCD on Arduino

This is hello world poject for the LCD on Arduino.
  • LCD RS pin to digital pin 2
  •  LCD Enable pin to digital pin3
  • LCD D4 pin to digital pin4
  • LCD D5 pin to digital pin5
  • LCD D6 pin to digital pin6
  • LCD D7 pin to digital pin 7
LCD Vss and RW pin will be connected to ground.

Code:
#include <LiquidCrystal.h>              // include the library code:                                         
LiquidCrystal lcd(2, 3, 4,5 , 6, 7);     // initialize the LCD with the numbers of the interface pins
                                                          // lcd(RS, Enable,D4,D5,D6,D7)
void setup() {
                        lcd.begin(16, 2);                           // set up the LCD's number of columns and rows:
                        lcd.print("mahabub's note");       // Print a message to the LCD.
                     }
void loop()
         {
         lcd.setCursor(6, 1);            // set the cursor to column 6, line 1
                                              // (note: line 1 is the second row, since counting begins with 0):
         lcd.print(millis() / 1000);    // print the number of seconds
         }

No comments:

Post a Comment