The function has to be called in the void setup() part of your sketch. The lcd.begin(cols, rows) function has to be called to define the kind of LCD display with the number of columns and rows. If you are using an LCD display with the I2C connection you do not define the connected pins because you do not connected to single pins but you define the HEX address and the display size: LiquidCrystal_I2C lcd(0x27, 20, 4)
If you want to operate in the 4-bit mode the function changes: LiquidCrystal(RS, R/W, Enable, d4, d5, d6, d7)
If R/W is connected to GND you do not use the parameter in the function: LiquidCrystal(RS, Enable, d0, d1, d2, d3, d4, d5, d6, d7) The order of the parameters is the following: LiquidCrystal(RS, R/W, Enable, d0, d1, d2, d3, d4, d5, d6, d7) You can use any of the Arduino digital pins to control the display. The parameters of the function define the connection between the LCD display and the Arduino. This function creates a variable of the type LiquidCrystal. These LCD’s can also operate on 4-bit mode in such case Data pin 4,5,6 and 7 will be left free. The Data Pins are connection to the Digital I/O pins of the microcontroller to send 8-bit data. So if we want to send data via the data pins 0 to 7, we have to make sure that the enable pin is high.ĭata pins 0 to 7 forms an 8-bit data line. Normally grounded to write data to LCDĬonnected to microcontroller pin and toggled between 1 and 0 for data acknowledgement. Select command register to low when we are sending commands to the LCD like set the cursor to a specific location, clear the display or turn off the display.Īnd select data register when RS is set to high to send data or characters to the LCD.ĭiffer between read or write data. We will connect the VEE pin to the potentiometer output to adjust the contrast by changing the resistance of the potentiometer. Also for a test 3V does the job.Īdjusts the contrast of the display If this pin is grounded, you get the maximum contrast. Ground pin to connected to the GND pin of the Arduino.