I want to find...

検索

Shares

Table of Content

lcd.createChar()

[LiquidCrystal]

説明

Create a custom character (gylph) for use on the LCD. Up to eight characters of 5×8 pixels are supported (numbered 0 to 7). The appearance of each custom character is specified by an array of eight bytes, one for each row. The five least significant bits of each byte determine the pixels in that row. To display a custom character on the screen, write() its number.

NB : When referencing custom character “0”, if it is not in a variable, you need to cast it as a byte, otherwise the compiler throws an error. See the example below.

構文

lcd.createChar(num, data)

媒介変数

  • lcd: a variable of type LiquidCrystal
  • num: which character to create (0 to 7)
  • data: the character’s pixel data

#include <LiquidCrystal.h>
 
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
 
byte smiley[8] = {
  B00000,
  B10001,
  B00000,
  B00000,
  B10001,
  B01110,
  B00000,
};
 
void setup() {
  lcd.createChar(0, smiley);
  lcd.begin(16, 2);  
  lcd.write(byte(0));
}
 
void loop() {}

Libraries Reference Home

86Duino のリファレンスのテキストは Arduino レファレンス を編集したもので、 Creative Commons Attribution-ShareAlike 3.0 License下でライセンスされています。リファレンス内のコードサンプルはパブリックドメインとして公開されています。

上部へスクロール