Topic 15 LCD Potentiometer
Topic 15 LCD Potentiometer
CT101-3-3
Prepared by: NKN First Prepared on: 01.08.18 Last Modified on: 15.11.2019
Quality checked by: SKS & KNT
Copyright 2012 Asia Pacific University of Technology and Innovation
Liquid Crystal Display
Requirement
1 Arduino UNO
1 USB Cable Principle
1 LCD1602 A photoresistor is a light-controlled variable
1 Photoresistor resistor. The resistance of a photoresistor
1 10KΩ Resistor decreases with the increasing incident light
1 10KΩ Potentiometer intensity; in other words, it exhibits
1 Breadboard photoconductivity. A photoresistor can be
Several Jumper Wires applied in light-sensitive detector circuits.
In this program we are turn on and off the backlight by supplying it with 5V
and a potentiometer to control contrast. It has a total number of 16 pins
altogether.
In this program we are turn on and off the backlight by supplying it with 5V
and a potentiometer to control contrast. It has a total number of 16 pins
altogether.
void setup()
{
lcd.begin(16, 2);
lcd.print("My Name is:");
}
void loop()
{
lcd.setCursor(0, 1);
}
#include <LiquidCrystal.h>
LiquidCrystal lcd(8, 9, 10, 11, 12, 13);
void setup()
{
lcd.begin(16, 2);
lcd.print("My Name is:");
lcd.setCursor(0, 1);
lcd.print(“Nathan");
}
void loop()
{
void setup()
{
lcd.begin(16, 2);
}
void loop()
{
lcd.print("Welcome To Malaysia");
lcd.setCursor(0, 0);
lcd.scrollDisplayLeft();
delay(250);
}
void setup()
{
lcd.begin(16, 2);
}
void loop()
{
lcd.setCursor(7, 1);
lcd.blink();
delay(3000);
lcd.noBlink();
lcd.setCursor(7, 0);
lcd.cursor();
delay(4000);
lcd.noCursor();
}
CT101-3-1-IIOT Module Introduction 12
Example
Text & Clear Screen
#include <LiquidCrystal.h>
LiquidCrystal lcd(8, 9, 10, 11, 12, 13);
void setup()
{
lcd.begin(16, 2);
}
void loop()
{
lcd.print("Maker Uno");
delay(3000);
lcd.clear();
lcd.setCursor(0,1);
lcd.print("Clear Text");
delay(3000);
lcd.clear();
}
CT101-3-1-IIOT Module Introduction 13
Exercise
Display text “Arduino” with 3 second delay
Display text “LCD Tutorial” at (Col 2, Row 2)
Clear the text
Blink for 4 sec at (Col 7, Row 2)
No blink for 3 sec
Display underscore (line) cursor for 4 sec
No cursor and clear screen
Display “Origin Academy” for 3 sec
Clear screen
CT101-3-1-IIOT Module Introduction 14
Internet of Things: Concepts and Application
CT101-3-3
Prepared by: NKN First Prepared on: 01.08.18 Last Modified on: 15.11.2019
Quality checked by: SKS & KNT
Copyright 2012 Asia Pacific University of Technology and Innovation
Schematic Diagram
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup()
{
// initialize the LCD
lcd.begin();
void loop()
{
// Do nothing here...
}
void loop()
{
/* Displays text sent over the serial port (e.g. from // If characters arrived over the serial
the Serial Monitor) on an attached LCD. port...
*/ if (Serial.available()) {
#include <Wire.h> // Wait a bit for the entire
#include <LiquidCrystal_I2C.h> message to arrive
delay(100);
// Set the LCD address to 0x27 for a 16 chars and // Clear the screen
2 line display lcd.clear();
LiquidCrystal_I2C lcd(0x27, 16, 2);
// Write all characters
void setup() received with the serial port to the LCD.
{ while (Serial.available() >
lcd.begin(); 0) {
lcd.backlight();
lcd.write(Serial.read());
// Initialize the serial port at a speed of }
9600 baud }
Serial.begin(9600); }
}
Q&A