{
    "ok": true,
    "data": {
        "title": "RGB_1602(chinese)",
        "rev_id": 384,
        "updated_at": "2015-07-06T07:10:17+00:00",
        "chunk_count": 14,
        "chunks": [
            {
                "title": "RGB_1602(chinese)",
                "rev_id": 384,
                "heading_path": "",
                "chunk_index": 0,
                "content": "# RGB 1602(chinese)",
                "char_count": 19,
                "token_estimate": 5
            },
            {
                "title": "RGB_1602(chinese)",
                "rev_id": 384,
                "heading_path": "产品简介",
                "chunk_index": 1,
                "content": "相比原来的LCD1602显示模块我们做了一些改进，使其融合LCD多彩显示和按键扩展功能。\nLCD1602是一款提供2行16字符液晶显示的树莓派扩展板。扩展了多个按键输入，可供用户作为LCD显示屏的菜单选择按键或者操控按键使用。\n一个扩展板就能让你与树莓派进行互动。用户可以通过调节扩展板上的微型电位器,调节LCD屏的对比度。\n对于树莓派初学者来说，不必为繁琐复杂液晶驱动电路连线而头疼了。\n这款1602 LCD扩展板将电路简化，直接将此板插到树莓派系统板上即可使用。\n通过i2c操作的mcp23016扩展io口,减少了对树莓派引脚的占用。\n调用wiringPi的lcd库，简单的几行代码便可以完数据和字符的显示功能。\n除此之外,显示模块可以单独取出和面包板搭配使用,避免了浪费。\n![TaterLi 修改\\|180px](DSC_0003.JPG \"TaterLi 修改|180px\")",
                "char_count": 393,
                "token_estimate": 422
            },
            {
                "title": "RGB_1602(chinese)",
                "rev_id": 384,
                "heading_path": "产品参数",
                "chunk_index": 2,
                "content": "|     项目      |        参数        |\n|:-------------:|:------------------:|\n|   模块电压    |         5V         |\n|   背光颜色    |       红绿蓝       |\n| 模块最大电流  |        60mA        |\n| LCD 显示模式  |        STN         |\n|   工作温度    |      0～+50℃       |\n|   存储温度    |     -20～+70℃      |\n|   模块尺寸    |     82x58(mm)      |\n|   显示区域    |      64.5x16       |\n| 显示字符数目  |       16x2行       |\n|    控制器     |      SplC780       |\n| 安装尺寸\/孔径 | 75.0\\*31.0\/ 2.8mm  |\n| 显示字符数目  |       16x2行       |\n|   LCD点大小   |    0.55\\*0.65mm    |\n| 接口形式\/尺寸 | 18PIN,PH2.54,1.0mm |",
                "char_count": 548,
                "token_estimate": 229
            },
            {
                "title": "RGB_1602(chinese)",
                "rev_id": 384,
                "heading_path": "产品展示",
                "chunk_index": 3,
                "content": "<img src=\"RGB1602_p1.JPG\" title=\"RGB1602_p1.JPG\" width=\"1000\" alt=\"RGB1602_p1.JPG\" \/>\n<img src=\"RGB1602_p4.JPG\" title=\"RGB1602_p4.JPG\" width=\"1000\" alt=\"RGB1602_p4.JPG\" \/>\n<img src=\"RGB1602_p5.JPG\" title=\"RGB1602_p5.JPG\" width=\"1000\" alt=\"RGB1602_p5.JPG\" \/>\n<img src=\"RGB1602_p3.JPG\" title=\"RGB1602_p3.JPG\" width=\"1000\" alt=\"RGB1602_p3.JPG\" \/>",
                "char_count": 343,
                "token_estimate": 86
            },
            {
                "title": "RGB_1602(chinese)",
                "rev_id": 384,
                "heading_path": "电气连接图",
                "chunk_index": 4,
                "content": "<figure>\n<img src=\"1602test1.png\" title=\"1602test1.png\" width=\"1000\" alt=\"1602test1.png\" \/>\n<figcaption aria-hidden=\"true\">1602test1.png<\/figcaption>\n<\/figure>",
                "char_count": 159,
                "token_estimate": 40
            },
            {
                "title": "RGB_1602(chinese)",
                "rev_id": 384,
                "heading_path": "产品尺寸大小",
                "chunk_index": 5,
                "content": "<img src=\"rgb1602_show3.JPG\" title=\"rgb1602_show3.JPG\" width=\"1000\" alt=\"rgb1602_show3.JPG\" \/>\n<img src=\"1602RGB_dimention.png\" title=\"1602RGB_dimention.png\" width=\"1100\" alt=\"1602RGB_dimention.png\" \/>",
                "char_count": 201,
                "token_estimate": 51
            },
            {
                "title": "RGB_1602(chinese)",
                "rev_id": 384,
                "heading_path": "RGB1602显示屏幕引脚说明",
                "chunk_index": 6,
                "content": "| 管脚号 | 符号 |       功能        |\n|:------:|:----:|:-----------------:|\n|   1    | Vss  |      电源地       |\n|   2    | Vdd  |     电源正极      |\n|   3    |  Vo  |    LCD偏压输入    |\n|   4    |  RS  |   数据命令选择    |\n|   5    | R\/W  |   读写控制信号    |\n|   6    |  E   |     使能信号      |\n|   7    | DB0  |     数据IO口0     |\n|   8    | DB1  |     数据IO口1     |\n|   9    | DB2  |     数据IO口2     |\n|   10   | DB3  |     数据IO口3     |\n|   11   | DB4  |     数据IO口4     |\n|   12   | DB5  |     数据IO口5     |\n|   13   | DB6  |     数据IO口6     |\n|   14   | DB7  |     数据IO口7     |\n|   15   | LEDA |   LED背光灯正极   |\n|   16   | LEDR | 红色LED背光灯控制 |\n|   17   | LEDG | 绿色LED背光灯控制 |\n|   18   | LEDB | 蓝色LED背光灯控制 |\n|        |      |                   |\n\n<img src=\"1602_RGB_test3.png\" title=\"1602_RGB_test3.png\" width=\"1000\" alt=\"1602_RGB_test3.png\" \/>",
                "char_count": 812,
                "token_estimate": 308
            },
            {
                "title": "RGB_1602(chinese)",
                "rev_id": 384,
                "heading_path": "如何使用",
                "chunk_index": 7,
                "content": "-   对于初次使用的用户请确保树莓派I2C接口已经打开,如何打I2C接口请参考 <http:\/\/www.52pi.net\/forum.php?mod=viewthread&tid=1363&highlight=rtc>\n-   操作RGB1602显示模块需要使用wiringPi库,如何安装wiringPi库请参考 <http:\/\/wiringpi.com\/download-and-install\/>\n-   wiringPi库安装完成后,在用户目录下输入以下代码`sudo vim.tiny lcd1602.c`,新建一个c文件\n\n<figure>\n<img src=\"1602_tech1.png\" title=\"1602_tech1.png\" width=\"800\" alt=\"1602_tech1.png\" \/>\n<figcaption aria-hidden=\"true\">1602_tech1.png<\/figcaption>\n<\/figure>\n\n-   将下面的[示例代码复制进新建立的lcd](#tech1 \"wikilink\")1602.c文件\n\n<figure>\n<img src=\"1602_tech2.png\" title=\"1602_tech2.png\" width=\"800\" alt=\"1602_tech2.png\" \/>\n<figcaption aria-hidden=\"true\">1602_tech2.png<\/figcaption>\n<\/figure>\n\n-   在vim编辑器下输入:字符,之后输入wq按回车键保存新建立的文件并退出编辑器\n\n<figure>\n<img src=\"1602_tech3.png\" title=\"1602_tech3.png\" width=\"600\" alt=\"1602_tech3.png\" \/>\n<figcaption aria-hidden=\"true\">1602_tech3.png<\/figcaption>\n<\/figure>\n\n-   使用gcc编译刚刚建立的C文件,输入`gcc lcd1602.c -lwiringPi \/home\/pi\/wiringPi\/devLib\/lcd.o -o lcd1602`编译程序\n\n<figure>\n<img src=\"1602_tech5.png\" title=\"1602_tech5.png\" width=\"800\" alt=\"1602_tech5.png\" \/>\n<figcaption aria-hidden=\"true\">1602_tech5.png<\/figcaption>\n<\/figure>\n\n-   编译成功好可以看到当前用户目录下面已经多了一个可执行文件lcd1602输入`sudo modprobe i2c-dev`加载i2c模块",
                "char_count": 1189,
                "token_estimate": 511
            },
            {
                "title": "RGB_1602(chinese)",
                "rev_id": 384,
                "heading_path": "如何使用",
                "chunk_index": 8,
                "content": "<img src=\"1602_tech6.png\" title=\"1602_tech6.png\" width=\"800\" alt=\"1602_tech6.png\" \/>\n<img src=\"1602_tech8.png\" title=\"1602_tech8.png\" width=\"600\" alt=\"1602_tech8.png\" \/>\n\n-   输入`sudo .\/lcd1602`执行可以看到RGB1602已经成功点亮了\n\n<img src=\"1602_tech9.png\" title=\"1602_tech9.png\" width=\"800\" alt=\"1602_tech9.png\" \/>\n<img src=\"show2.JPG\" title=\"show2.JPG\" width=\"800\" alt=\"show2.JPG\" \/>\n\n-   彩色背光展示\n\n![](show1.gif \"show1.gif\")",
                "char_count": 409,
                "token_estimate": 129
            },
            {
                "title": "RGB_1602(chinese)",
                "rev_id": 384,
                "heading_path": "示例代码说明",
                "chunk_index": 9,
                "content": "#include <stdio.h>                                                            \/\/添加标准输入输出头文件\n    #include <wiringPi.h>                                                         \/\/添加wiringpi头文件\n    #include <mcp23017.h>                                                         \/\/添加mcp23017操作头文件\n    #include <lcd.h>                                                              \/\/添加lcd操作头文件\n    #include <softPwm.h>                                                          \/\/添加软件pwm头文件\n    int main()\n    {\n        long value=0;\n        int rand_num;\n        int value_blue;                                                       \/\/蓝色背光亮度\n        int value_red;                                                        \/\/红色背光亮度\n        int value_green;                                                      \/\/绿色背光亮度\n        int display,i,count;\n        wiringPiSetup();                                                      \/\/初始化wiringPi\n        mcp23017Setup (100, 0x20);                                            \/\/初始化mcp23017芯片i2c地址0x20,地址起始100\n        printf (\"Raspberry Pi - MCP23017 Test\\n\");                            \/\/打印信息\n        for(i=0;i<16;i++)",
                "char_count": 1148,
                "token_estimate": 379
            },
            {
                "title": "RGB_1602(chinese)",
                "rev_id": 384,
                "heading_path": "示例代码说明",
                "chunk_index": 10,
                "content": "pinMode(100+i,OUTPUT);                                                \/\/配置引脚 100 - 115为输出\n        digitalWrite(101,0);                                                  \/\/引脚101为低电平\n        display=lcdInit(2,16,4,100,102,103,104,105,106,0,0,0,0);              \/\/lcd初始化2*16,4位控制,使用100,101,102,103,104脚作为控制引脚\n        lcdHome(display);                                                     \/\/光标复位\n        lcdClear(display);                                                    \/\/清空屏幕\n        lcdPosition(display,0,0);                                             \/\/设置显示位置(0,0)\n        lcdPuts(display,\"Hello World\");                                       \/\/打印字符Hello World\n        lcdPosition(display,0,1);                                             \/\/设置显示位置(0,1)\n        lcdPuts(display,\"www.52pi.net\");                                      \/\/打印字符(www.52pi.net)\n        pinMode(0, OUTPUT);                                                   \/\/树莓派GPIO引脚0设置为输出\n        pinMode(2, OUTPUT);                                                   \/\/树莓派GPIO引脚2设置为输出\n        pinMode(3, OUTPUT);                                                   \/\/树莓派GPIO引脚3设置为输出",
                "char_count": 1141,
                "token_estimate": 393
            },
            {
                "title": "RGB_1602(chinese)",
                "rev_id": 384,
                "heading_path": "示例代码说明",
                "chunk_index": 11,
                "content": "softPwmCreate (3, 50, 100);                                           \/\/软件pwm设置引脚3 pwm值范围0-100 初始50\n        softPwmCreate (2, 50, 100);                                           \/\/软件pwm设置引脚2 pwm值范围0-100 初始50\n        softPwmCreate (0, 50, 100);                                           \/\/软件pwm设置引脚0 pwm值范围0-100 初始50\n    while(1)                                                                      \/\/循环\n    {",
                "char_count": 408,
                "token_estimate": 146
            },
            {
                "title": "RGB_1602(chinese)",
                "rev_id": 384,
                "heading_path": "示例代码说明",
                "chunk_index": 12,
                "content": "delay(200);                                                            \/\/延时200ms\n            value_red=(value<100)?value:0;                                         \/\/0-100之间时红色颜色渐变\n        value_green=(value>100&&value<200)?(value-100):0;                      \/\/100-200之间时绿色渐变\n        value_blue=(value>200)?(value-200):0;                                  \/\/200-300之间时蓝色渐变\n        if(value>300)                                                          \/\/大于300时,颜色随机跳转\n        {\n            value_red=rand()%100;\n            value_green=rand()%100;\n            value_blue=rand()%100;\n        }\n        \/\/rand_num=rand();\n        softPwmWrite (3,value_red);                                             \/\/软件pwm控制红色\n        softPwmWrite (2,value_green);                                           \/\/软件pwm控制绿色\n        softPwmWrite (0,value_blue);                                            \/\/软件pwm控制蓝色\n\nvalue++;\n        if(value>900)                                                           \/\/累加值在900,轮回\n        {\n            value=0;\n        }\n\nlcdPosition(display,13,1);\n        lcdPrintf(display,\"%d\",value);                                           \/\/显示累加数值\n        \/\/value_blue=0;\n\n}\n    }",
                "char_count": 1190,
                "token_estimate": 378
            },
            {
                "title": "RGB_1602(chinese)",
                "rev_id": 384,
                "heading_path": "附件",
                "chunk_index": 13,
                "content": "[参考代码](#1306-0.91-CODE.zip \"wikilink\")\n[屏幕手册](#SSD1306-Revision_1.0.pdf \"wikilink\")",
                "char_count": 83,
                "token_estimate": 31
            }
        ]
    }
}