Devices & Components
Arduino Uno Rev3
Alphanumeric LCD, 16 x 2
Jumper wires (generic)
Resistor 220 ohm
Software & Tools
Arduino IDE
Project description
Code
Lcd without potentiometer
c_cpp
1#include <LiquidCrystal.h> //Import the LCD library 2//Include^ 3//Init 4LiquidCrystal lcd(12, 11, 5, 4, 3, 2); /*Initialize the LCD and 5 tell it which pins is 6 to be used for communicating*/ 7 8 9const int contrast = 13; 10 11void setup() { 12 analogWrite(contrast, 130); 13 // put your setup code here, to run once: 14 lcd.begin(16, 2); //Tell the LCD that it is a 16x2 LCD 15 //pinMode-ing OUTPUT makes the specified pin output power 16} 17 18void loop() { 19 // put your main code here, to run repeatedly: 20 lcd.print(" Hello, World!!"); //Output " Hello, World!!" on the first line of the LCD 21 lcd.setCursor(0, 1); /*Set the (invisible) cursor on the first place second row of the LCD. 22 Cursor values are 0-indexed, 0 would the be the first place. 23 The cursor coordinates are X,Y coordinates.*/ 24 lcd.print("16x2 LCD Screen"); 25 delay(1000); //Wait a second 26 for (int l = 0; l < 16; l++) { //For loop. Repeating 16 times 27 lcd.scrollDisplayRight(); //Scroll whole screen to the right once 28 delay(90); //Slight delay for animation 29 } 30 delay(1000); 31 for (int l = 0; l < 16; l++) 32 lcd.scrollDisplayLeft(); 33 for (int l = 51; l > -1; l--) { //Repeating 51 times 34 analogWrite(bri, l * 5); 35 delay(35); 36 } 37 delay(1000); 38 for (int l = 0; l < 51; l++) { //Repeating 51 times 39 analogWrite(contra, l * 5); 40 delay(35); 41 } 42 delay(1000); 43 lcd.setCursor(0, 0); 44}
Downloadable files
__2022-05-29_193755_FRZhf81PsI.png
__2022-05-29_193755_FRZhf81PsI.png

__2022-05-29_193755_FRZhf81PsI.png
__2022-05-29_193755_FRZhf81PsI.png

Comments
Only logged in users can leave comments