لطفاً برای مشاهده و دانلود دوره، وارد سایت شوید یا ثبت نام کنید.

بررسی کتابخانه و توابع ماژول:

 

در این جلسه کتابخانه LiquidCrystal_I2C را نصب می کنیم و توابع آن را بررسی می کنیم.

 

LiquidCrystal_I2C() //set the LCD address for a 16 chars and 2 line display

init() //Initialization for the LCD

clear() //clear display, set cursor position to zero

home() //set cursor position to zero

createChar() //Fill the first 8 CGRAM locations with custom characters

setCursor() //set the position of the cursor

cursor() //Turns the underline cursor on

noCursor() //Turns the underline cursor off

blink() //Turn on the blinking cursor

noBlink() //Turn off the blinking cursor

display() //Turn the display on(quickly)

noDisplay() //Turn the display 0ff(quickly)

backlight() //Turn the backlight on

noBacklight() //Turn the backlight off

scrollDisplayLeft() //Make the display scroll left without changing the RAM

scrollDisplayRight() //Make the display scroll right without changing the RAM

autoscroll() //This will 'right justify' text from the cursor

noAutoscroll() //This will 'left justify' text from the cursor

leftToRight() //This is for text that flows Left to Right

rightToLeft() //This is for text that flows Right to Left

Sample Code

 

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

// AT -> 0x3F T -> 0x27
LiquidCrystal_I2C lcd(0x27,16,2); // Display  I2C 16 x 2
 
void setup() {
  
  lcd.init();                      // initialize the lcd 
  lcd.backlight();
  lcd.clear();
  lcd.home();
  lcd.print("    karit.ir    ");

  delay(2000);

  lcd.noBacklight();
  delay(1500);
  lcd.backlight();
  lcd.setCursor(0,1);
  lcd.print("Hello, world!");
  delay(3000);
  lcd.clear();
}

// the loop function runs over and over again forever
void loop() {  
  
  lcd.clear();
  lcd.print("Cursor blink");
  lcd.blink();
  delay(3000);

  lcd.clear();
  lcd.print("No cursor blink");
  lcd.noBlink();
  delay(3000);  
}

 

لطفاً برای مشاهده و دانلود دوره، وارد سایت شوید یا ثبت نام کنید.

برای ثبت نظر یا دیدگاه، وارد سایت شوید یا ثبت نام کنید و در دوره ثبت نام کنید.

هنوز نظر یا دیدگاهی ثبت نشده!

  • مدرس دوره: مصطفی سوختانلو
  • سطح دوره: مقدماتی، متوسط
  • وضعیت دوره: تکمیل شده
  • جلسه: 3
  • مدت زمان این جلسه: 00:09:24
  • آخرین بروزرسانی این جلسه: 1402/09/21