captain_nemo01
Published © GPL3+

Lcd Without Potentiometer

Shows how to use an lcd without a potentiomer!

IntermediateProtip2,472
Lcd Without Potentiometer

Things used in this project

Hardware components

Alphanumeric LCD, 16 x 2
Alphanumeric LCD, 16 x 2
×1
Arduino UNO
Arduino UNO
Any other will work too!
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Resistor 220 ohm
Resistor 220 ohm
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

__2022-05-29_193755_FRZhf81PsI.png

Code

Lcd without potentiometer

C/C++
#include <LiquidCrystal.h> //Import the LCD library
//Include^
//Init
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); /*Initialize the LCD and
                                        tell it which pins is
                                        to be used for communicating*/


const int contrast = 13;

void setup() {
  analogWrite(contrast, 130);
  // put your setup code here, to run once:
  lcd.begin(16, 2); //Tell the LCD that it is a 16x2 LCD
  //pinMode-ing OUTPUT makes the specified pin output power
}

void loop() {
  // put your main code here, to run repeatedly:
  lcd.print(" Hello, World!!"); //Output " Hello, World!!" on the first line of the LCD
  lcd.setCursor(0, 1); /*Set the (invisible) cursor on the first place second row of the LCD.
                        Cursor values are 0-indexed, 0 would the be the first place.
                        The cursor coordinates are X,Y coordinates.*/
  lcd.print("16x2 LCD Screen");
  delay(1000); //Wait a second
  for (int l = 0; l < 16; l++) { //For loop. Repeating 16 times
    lcd.scrollDisplayRight(); //Scroll whole screen to the right once
    delay(90); //Slight delay for animation
  }
  delay(1000);
  for (int l = 0; l < 16; l++)
    lcd.scrollDisplayLeft();
  for (int l = 51; l > -1; l--) { //Repeating 51 times
    analogWrite(bri, l * 5);
    delay(35);
  }
  delay(1000);
  for (int l = 0; l < 51; l++) { //Repeating 51 times
    analogWrite(contra, l * 5);
    delay(35);
  }
  delay(1000);
  lcd.setCursor(0, 0);
}

Credits

captain_nemo01

captain_nemo01

0 projects • 0 followers

Comments