Advertisement
pleasedontcode

LCD Control rev_33

Dec 25th, 2023
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /********* Pleasedontcode.com **********
  2.  
  3.     Pleasedontcode thanks you for automatic code generation! Enjoy your code!
  4.  
  5.     - Terms and Conditions:
  6.     You have a non-exclusive, revocable, worldwide, royalty-free license
  7.     for personal and commercial use. Attribution is optional; modifications
  8.     are allowed, but you're responsible for code maintenance. We're not
  9.     liable for any loss or damage. For full terms,
  10.     please visit pleasedontcode.com/termsandconditions.
  11.  
  12.     - Project: LCD Control
  13.     - Source Code compiled for: Arduino Nano
  14.     - Source Code created on: 2023-12-25 08:58:25
  15.  
  16. ********* Pleasedontcode.com **********/
  17.  
  18. /****** SYSTEM REQUIREMENTS *****/
  19. /****** SYSTEM REQUIREMENT 1 *****/
  20.     /* Print "Merry Christmas!" In loop function */
  21. /****** END SYSTEM REQUIREMENTS *****/
  22.  
  23. /****** DEFINITION OF LIBRARIES *****/
  24. #include <Arduino.h>
  25. #include <Wire.h>
  26. #include <LiquidCrystal_I2C.h>
  27.  
  28. /****** FUNCTION PROTOTYPES *****/
  29. void setup(void);
  30. void loop(void);
  31.  
  32. /***** DEFINITION OF I2C PINS *****/
  33. const uint8_t Lcd_LCD1602I2C_I2C_PIN_SDA_A4 = A4;
  34. const uint8_t Lcd_LCD1602I2C_I2C_PIN_SCL_A5 = A5;
  35. const uint8_t Lcd_LCD1602I2C_I2C_SLAVE_ADDRESS = 0x27;
  36.  
  37. /****** DEFINITION OF LIBRARY CLASS INSTANCES*****/
  38. LiquidCrystal_I2C lcd(Lcd_LCD1602I2C_I2C_SLAVE_ADDRESS, 20, 4);
  39.  
  40. void setup(void)
  41. {
  42.   // Initialize the I2C communication
  43.   Wire.begin();
  44.  
  45.   // Initialize the LCD
  46.   lcd.begin(20, 4);
  47.  
  48.   // Turn on the backlight
  49.   lcd.backlight();
  50.  
  51.   // Set the cursor position and print the text
  52.   lcd.setCursor(3, 0);
  53.   lcd.print("Hello, world!");
  54.   lcd.setCursor(2, 1);
  55.   lcd.print("Ywrobot Arduino!");
  56.   lcd.setCursor(0, 2);
  57.   lcd.print("Arduino LCM IIC 2004");
  58.   lcd.setCursor(2, 3);
  59.   lcd.print("Power By Ec-yuan!");
  60. }
  61.  
  62. void loop(void)
  63. {
  64.   // Print "Merry Christmas!" repeatedly
  65.   lcd.setCursor(0, 3);
  66.   lcd.print("Merry Christmas!");
  67.  
  68.   // Delay for 1 second
  69.   delay(1000);
  70. }
  71.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement