Matrix - I2C LCD1602

From FriendlyELEC WiKi
Revision as of 07:14, 27 July 2015 by Tzs (Talk | contribs)

Jump to: navigation, search

1 介绍

I2C LCD1602

TODO

2 特性

  • 特性1
  • 特性2

3 使用方法

3.1 连接

  • 连接到Tiny4412 SDK (1506)
GND: 接地
VCC: 接5V
SDA: I2C SDA
SCL: I2C SCL

3.2 Linux下的C示例

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include "libfahw.h"
 
void test(char* line1, char* line2)
{
    int devFD;
    if ((devFD = LCD1602Init()) == -1) {
        printf("Fail to init LCD1602\n");
        return;
    }
 
            if (LCD1602Clear(devFD) == -1) {
                    printf("Fail to Clear\n");
                    return;
            }
 
    if (LCD1602DispLines(devFD, line1, line2) == -1) {
        printf("Fail to Display String\n");
        return ;
    }
 
    LCD1602DeInit(devFD);
}
 
int main(int argc, char ** argv) {
    int i;
    for (i=0; i<10; i++) {
         test("FriendlyARM", "From 2003");
         sleep(3);
    }
    return 0;
}

3.3 编译并运行示例

git clone http://github.com/friendlyarm/fa-hardware.git
cd fa-hardware
cd demo
cd matrix-i2c_lcd1602
make

将编译生成的LCD1602通过ftp上传到开发板上运行即可测试。

4 相关资料