Was this page helpful?

I2C LCD

    內容表格
    沒有標頭

    從淘寶買來的 I2C LCD (http://item.taobao.com/item.htm?spm=a230r.1.10.209&id=18859272993):

    2012-09-02_13h50_56.png

     

    特性:

    • 16x2 LCD,藍底白字,有背光
    • 走 I2C 介面,設備地址為 0x27
    • 可調整螢幕顯示對比
    • 5V 供電,相容於 Arduino

     

    接線辦法:

    20120902_142943.jpg

     

    參考上圖,接線方式為: 

    SDA - 接 Arduino 的 Analog Pin 4 (Arduino mega 為 Pin 20)
    SCL - 接 Arduino 的 Analog Pin 5 (Arduino mega 為 Pin 21)
    GND - 接 GND
    VCC - 接 +5V

     

    I2C LCD 函式庫:

     

     

    16x2 LCD 請下載這個 library: http://arduino-info.wikispaces.com/f..._I2C1602V1.zip

    16x4 LCD 請下載這個 library: http://arduino-info.wikispaces.com/f..._I2C2004V1.zip

     

    範例程式:

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

    LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display

    void setup()
    {
      lcd.init();                      // initialize the lcd 
     
      // Print a message to the LCD.
      lcd.backlight();
      lcd.print("Hello, world!");
    }

    void loop()
    {
    }

    執行結果: 

    2012-09-02 14.33.41.png 

    Was this page helpful?
    標籤 (Edit tags)
    • No tags
    您必須 登入 才能發佈評論。
    Powered by MindTouch Core