[Banana pi Accessories] BPI-LCD1602 module and How to use

1.Product Specification:

2.Produce Overview: The RGB1602 Display module is specifically designed for Banana Pi. The module with 1602 LCD screen and it communicated with Banana Pi with I2C. In addition there are six programmable key and RGB LED on the module. User can use Python or C(wiringPi) to drive the module with simple and less code. 3.Produce Features: 1602 LCD screen RGB LED on board 6 programmable single key Communicate with I2C Can be controlled by the program backlit lights out 4.Port: Banana Pi connection port 5.Product Parameters: Working voltage: 5.0V ASC II string can be sidplay 4 wire to drive the 1602 LCD screen Use MCP23017 to expand IO 6.Typical Application: Information monitoring School educational Human-computer interaction 7.How to use: Just insert the module to Banana Pi, like the below picture:

code file lcd1602.c :

#include <stdio.h>                                                                        
#include <wiringPi.h>                                                             
#include <mcp23017.h>                                                          //将wiringPI中提供的MCP23017的库包含到程序中
#include <lcd.h>                                                               //将wirongPi中提供的LCD驱动库包含到程序中
int main()
        int display,i,count;                                                       //定义几个等下需要使用的变凉
        wiringPiSetup();                                                           //初始化wiringPi
        mcp23017Setup (100, 0x20);                                                 //初始化MCP23017芯片,IO口起始编号为100,I2C地址为0x20
        printf ("Banana pi - MCP23017 Test\n");
          pinMode(100+i,OUTPUT);                                                   //将拓展出的IO口全部置为输出模式
        digitalWrite(107,1);                                                       //将107引脚置为高电平,点亮LCD背光灯
        digitalWrite(101,0);                                                       //将R/W置为低电平,将LCD设置为写入状态
        display=lcdInit(2,16,4,100,102,103,104,105,106,0,0,0,0);                   //初始化LCD屏幕
        lcdHome(display);                                                          //将LCD的光标归位
        lcdClear(display);                                                               //清屏
        lcdPosition(display,0,0);                                                  //设置LCD屏幕显示初始位置
        lcdPuts(display,"Hello World");                                            //在屏幕上显示“Hello World”
                lcdPrintf(display,"%d",count++);                                       //自动循环加1   
                delay(300);                                                            //延时300毫秒

compile file:

gcc lcd1602.c /home/pi/wiringPi/devLib/lcd.o -lwiringPi -o lcd1602