{
    "ok": true,
    "data": {
        "title": "RGB_1602(English)",
        "rev_id": 521,
        "updated_at": "2015-07-13T02:40:58+00:00",
        "chunk_count": 16,
        "chunks": [
            {
                "title": "RGB_1602(English)",
                "rev_id": 521,
                "heading_path": "",
                "chunk_index": 0,
                "content": "# RGB 1602(English)",
                "char_count": 19,
                "token_estimate": 5
            },
            {
                "title": "RGB_1602(English)",
                "rev_id": 521,
                "heading_path": "Description",
                "chunk_index": 1,
                "content": "We made some improvements based on the former LCD1602 module, so that this RGB1602 is now able to switch different backlight colors, and it has five built-in function keys.\nRGB1602 display module has two rows and sixteen columns which shows 16\\*2 characters.\nThe backlight can switch between plenty of colors such as red, green, blue, pink and yellow, etc.\nThe module uses a MCP23017 port expander chip in order to expand Raspberry Pi's IO pins and decrease the amount of IO pins the user needs to operate the display module.\nThis module requires only I2C interface and three IO pins to control the display and 5 function keys. It is reliable and easy-to-setup.\nThe screen itself could be unmounted individually. After unmounting, the screen can be used on a bread board for other customized usages.",
                "char_count": 799,
                "token_estimate": 200
            },
            {
                "title": "RGB_1602(English)",
                "rev_id": 521,
                "heading_path": "Technical Details",
                "chunk_index": 2,
                "content": "|        type        |       value        |\n|:------------------:|:------------------:|\n|    work voltage    |         5V         |\n|     backlight      |   red green blue   |\n|  maximum current   |        60mA        |\n|  LCD display type  |        STN         |\n|  work temprature   |      0～+50℃       |\n| storage temprature |     -20～+70℃      |\n|       scale        |     82x58(mm)      |\n|   display scale    |    64.5x16(mm)     |\n|  character number  |        16x2        |\n|    control chip    |      SplC780       |\n|     mount hole     | 75.0\\*31.0\/ 2.8mm  |\n|     LCD pixel      |    0.55\\*0.65mm    |\n|     connector      | 18PIN,PH2.54,1.0mm |",
                "char_count": 657,
                "token_estimate": 165
            },
            {
                "title": "RGB_1602(English)",
                "rev_id": 521,
                "heading_path": "Overview",
                "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\" \/>\n<img src=\"Rgb1602_01.JPG\" title=\"Rgb1602_01.JPG\" width=\"1000\" alt=\"Rgb1602_01.JPG\" \/>",
                "char_count": 429,
                "token_estimate": 108
            },
            {
                "title": "RGB_1602(English)",
                "rev_id": 521,
                "heading_path": "Schematic",
                "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(English)",
                "rev_id": 521,
                "heading_path": "LCD module scale",
                "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(English)",
                "rev_id": 521,
                "heading_path": "RGB1602 pin description",
                "chunk_index": 6,
                "content": "| pin number | chart |           function           |\n|:----------:|:-----:|:----------------------------:|\n|     1      |  Vss  |             GND              |\n|     2      |  Vdd  |        Voltage supply        |\n|     3      |  Vo   |         LCD contrast         |\n|     4      |  RS   |       register select        |\n|     5      |  R\/W  |     read or write select     |\n|     6      |   E   |            enable            |\n|     7      |  DB0  |          data pin 0          |\n|     8      |  DB1  |          data pin 1          |\n|     9      |  DB2  |          data pin 2          |\n|     10     |  DB3  |          data pin 3          |\n|     11     |  DB4  |          data pin 4          |\n|     12     |  DB5  |          data pin 5          |\n|     13     |  DB6  |          data pin 6          |\n|     14     |  DB7  |         daata pin 7          |\n|     15     | LEDA  | LED backlight voltage supply |\n|     16     | LEDR  |  red LED backlight control   |\n|     17     | LEDG  | green LED backlight control  |\n|     18     | LEDB  |  blue LED backlight control  |\n|            |       |                              |",
                "char_count": 1133,
                "token_estimate": 284
            },
            {
                "title": "RGB_1602(English)",
                "rev_id": 521,
                "heading_path": "RGB1602 pin description",
                "chunk_index": 7,
                "content": "<img src=\"1602_RGB_test3.png\" title=\"1602_RGB_test3.png\" width=\"1000\" alt=\"1602_RGB_test3.png\" \/>",
                "char_count": 97,
                "token_estimate": 25
            },
            {
                "title": "RGB_1602(English)",
                "rev_id": 521,
                "heading_path": "Learn",
                "chunk_index": 8,
                "content": "-   If it's the first time for you to use Raspberry Pi, please make sure the I2C interface is enabled. This page will show you how to enable the I2C interface. <http:\/\/www.52pi.net\/forum.php?mod=viewthread&tid=1363&highlight=rtc>\n-   You also need to install wiringPi library. This page will show you how to install wiringPi. <http:\/\/wiringpi.com\/download-and-install\/>\n-   If you are done install the wiringPi and enabling I2C interface, type the following code in the console to build a .c file\n\n`sudo vim.tiny lcd1602.c`\n<img src=\"1602_tech1.png\" title=\"1602_tech1.png\" width=\"800\" alt=\"1602_tech1.png\" \/>\n\n-   Copy and paste the following [demo code](#tech1 \"wikilink\") into lcd1602.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-   Under the vim.tiny editor, type \":\", then type \"wq\" and press \"enter\" to save the lcd1602.c file and exit editor\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>",
                "char_count": 1134,
                "token_estimate": 284
            },
            {
                "title": "RGB_1602(English)",
                "rev_id": 521,
                "heading_path": "Learn",
                "chunk_index": 9,
                "content": "-   Next you need to compile the code using gcc. Type `gcc lcd1602.c -lwiringPi \/home\/pi\/wiringPi\/devLib\/lcd.o -o lcd1602` in the console to compile.\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-   You should find an executable file named \"lcd1602\" if the last step was completed. Type the following code `sudo modprobe i2c-dev` to load the I2C interface\n\n<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-   Lastly, type `sudo .\/lcd1602` , and the module will be displaying the demo text, as the following photo shows.\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-   This is a gif showing the different backlight colors\n\n<img src=\"show1.gif\" title=\"show1.gif\" width=\"800\" alt=\"show1.gif\" \/>",
                "char_count": 1047,
                "token_estimate": 262
            },
            {
                "title": "RGB_1602(English)",
                "rev_id": 521,
                "heading_path": "Demo Code",
                "chunk_index": 10,
                "content": "#include <stdio.h>                                                            \/\/include standard input output head file\n    #include <wiringPi.h>                                                         \/\/include wiringpi\n    #include <mcp23017.h>                                                         \/\/include mcp23017 control head file\n    #include <lcd.h>                                                              \/\/include LCD control head file\n    #include <softPwm.h>                                                          \/\/include PWM control head file\n    int main()\n    {\n        long value=0;\n        int rand_num;\n        int value_blue;                                                       \/\/the blue backlight brightness\n        int value_red;                                                        \/\/the red backlight brightness\n        int value_green;                                                      \/\/the green backlight brightness\n        int display,i,count;\n        wiringPiSetup();                                                      \/\/init wiringPi",
                "char_count": 1085,
                "token_estimate": 272
            },
            {
                "title": "RGB_1602(English)",
                "rev_id": 521,
                "heading_path": "Demo Code",
                "chunk_index": 11,
                "content": "mcp23017Setup (100, 0x20);                                            \/\/init mcp23017 chip I2C address: 0x20,the first pin number: 100\n        printf (\"Raspberry Pi - MCP23017 Test\\n\");                            \/\/print information\n        for(i=0;i<16;i++)\n        pinMode(100+i,OUTPUT);                                                \/\/set pin 100 - 115 as output\n        digitalWrite(101,0);                                                  \/\/set pin 101 low voltage\n        display=lcdInit(2,16,4,100,102,103,104,105,106,0,0,0,0);              \/\/lcd init 2*16,4 bit control,use 100,101,102,103,104 pin as control pin\n        lcdHome(display);                                                     \/\/reset cursor\n        lcdClear(display);                                                    \/\/clear screen\n        lcdPosition(display,0,0);                                             \/\/set display location (0,0)\n        lcdPuts(display,\"Hello World\");                                       \/\/print string \"Hello World\"\n        lcdPosition(display,0,1);                                             \/\/set display location(0,1)\n        lcdPuts(display,\"www.52pi.",
                "char_count": 1162,
                "token_estimate": 291
            },
            {
                "title": "RGB_1602(English)",
                "rev_id": 521,
                "heading_path": "Demo Code",
                "chunk_index": 12,
                "content": "net\");                                      \/\/print string \"www.52pi.net\"\n        pinMode(0, OUTPUT);                                                   \/\/set Raspberry pi pin 0 as output\n        pinMode(2, OUTPUT);                                                   \/\/set Raspberry Pi pin 2 as output\n        pinMode(3, OUTPUT);                                                   \/\/set Raspberry Pi pin 3 as output\n        softPwmCreate (3, 50, 100);                                           \/\/set soft PWM pin 3 PWM scale (0-100) original 50\n        softPwmCreate (2, 50, 100);                                           \/\/set soft PWM pin 2 PWM scale (0-100) original 50\n        softPwmCreate (0, 50, 100);                                           \/\/set soft PWM pin 0 PWM scale (0-100) original 50\n    while(1)                                                                      \/\/always display\n    {",
                "char_count": 904,
                "token_estimate": 226
            },
            {
                "title": "RGB_1602(English)",
                "rev_id": 521,
                "heading_path": "Demo Code",
                "chunk_index": 13,
                "content": "delay(200);                                                            \/\/delay 200ms\n            value_red=(value<100)?value:0;                                         \/\/0-100 red change\n        value_green=(value>100&&value<200)?(value-100):0;                      \/\/100-200 green change\n        value_blue=(value>200)?(value-200):0;                                  \/\/200-300 blue change\n        if(value>300)                                                          \/\/>300 random colour\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);                                             \/\/soft PWM control red backlight\n        softPwmWrite (2,value_green);                                           \/\/soft PWM control green backlight\n        softPwmWrite (0,value_blue);                                            \/\/soft PWM control blue backlight\n\nvalue++;\n        if(value>900)                                                           \/\/if value >900 return\n        {\n            value=0;\n        }",
                "char_count": 1137,
                "token_estimate": 285
            },
            {
                "title": "RGB_1602(English)",
                "rev_id": 521,
                "heading_path": "Demo Code",
                "chunk_index": 14,
                "content": "lcdPosition(display,13,1);\n        lcdPrintf(display,\"%d\",value);                                           \/\/print number value\n        \/\/value_blue=0;\n\n}\n    }",
                "char_count": 161,
                "token_estimate": 41
            },
            {
                "title": "RGB_1602(English)",
                "rev_id": 521,
                "heading_path": "Attachment",
                "chunk_index": 15,
                "content": "[LCD manuals](media:TC1602A-01T.pdf \"wikilink\")\n[demo code](media:Lcd1602_rgb.zip \"wikilink\")",
                "char_count": 93,
                "token_estimate": 24
            }
        ]
    }
}