[Arduino] LCM

#include<LiquidCrystal.h>
LiquidCrystal LCD(12,11,2,3,4,5); //宣告一個名為LCD的LiquidCrystal
byte left[8] = {B00100,B01000,B10000,B00000,B00000,B00000,B00000,B00000}; //符號ˊ
byte dot[8] = {B00000,B01100,B01100,B00000,B00000,B00000,B00000,B00000}; //符號・
byte right[8] = {B00100,B00010,B00001,B00000,B00000,B00000,B00000,B00000}; //符號ˋ
void setup() {
    //創建字元
    LCD.createChar(0,left);
    LCD.createChar(1,dot); 
    LCD.createChar(2,right);
    LCD.begin(16,2);
    LCD.print("Hello,World!");
    //在(5,1)印出(´・ω・`)
    LCD.setCursor(5,1);
    LCD.write("(");
    LCD.write(byte(0));
    LCD.write(byte(1));
    LCD.write("w");
    LCD.write(byte(1));
    LCD.write(byte(2));
    LCD.write(")");
}
void loop() {
    //在(0,1)印出經過時間(秒)
    LCD.setCursor(0,1);
    LCD.print(millis()/1000);
}

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *