{
    "ok": true,
    "data": {
        "title": "Z-0234",
        "rev_id": 12960,
        "updated_at": "2023-04-18T06:48:15+00:00",
        "chunk_count": 27,
        "chunks": [
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "",
                "chunk_index": 0,
                "content": "# Z-0234",
                "char_count": 8,
                "token_estimate": 2
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "1602 Serial LCD Module Display",
                "chunk_index": 1,
                "content": "<figure>\n<img src=\"Lcd1602blue01.jpg\" title=\"Lcd1602blue01.jpg\" width=\"300\" alt=\"Lcd1602blue01.jpg\" \/>\n<figcaption aria-hidden=\"true\">Lcd1602blue01.jpg<\/figcaption>\n<\/figure>\n\n-   Purchase URL \\[ <https:\/\/52pi.com\/products\/52pi-i2c-1602-lcd-display-module-16x2-character-serial-blue-yellow-backlight-lcd-module> \\]",
                "char_count": 314,
                "token_estimate": 79
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "Description",
                "chunk_index": 2,
                "content": "As we know, the LCD1602 is an industrial character LCD that can display 16x02 or 32 characters at the same time.\nThe principle of the LCD1602 liquid crystal display is to use the physical characteristics of the liquid crystal to control the display area by voltage,\nthat is, the graphic can be displayed.\nIn general, the 1602 uses a standard 16-pin interface, and our display module is a module that provides I2C functionality.\nI²C uses only two bidirectional open-drain lines, Serial Data Line (SDA) and Serial Clock Line (SCL),\npulled up with resistors. Typical voltages used are +5 V or +3.3 V although systems with other voltages are permitted.\nIt can be operated as long as it supports the I2C development board.\nFor example, the common Arduino, raspberry pi, Stm32 and so on.",
                "char_count": 781,
                "token_estimate": 196
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "Features",
                "chunk_index": 3,
                "content": "-   Easy to use. <img src=\"Lcd1602blue02.jpg\" title=\"Lcd1602blue02.jpg\" width=\"300\" alt=\"Lcd1602blue02.jpg\" \/>\n-   Less I\/O ports are occupied\n-   Support IIC Protocol.\n-   The I2C LCD1602 library is easy to get\n-   With a potentiometer used to adjust backlight and contrast\n-   Blue backlight\n-   Power supply: 5v\n-   I2C address is: new version is 0x3F, Old version is 0x27\n\n<!-- -->\n\n    NOTE: After continuous iteration, the new product has updated the address of the register. At present, the address of the latest product is 0x3F, and the original old version is 0x2F. For the difference method, please check that the silk screen of the adapter board on the back contains MH as the new version, and the distance between the sliding rheostat The bottom pad space is larger.\n\n<img src=\"Compations.jpeg\" title=\"Compations.jpeg\" width=\"800\" alt=\"Compations.jpeg\" \/>",
                "char_count": 867,
                "token_estimate": 217
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "Package include",
                "chunk_index": 4,
                "content": "-   2 x Blue backlight I2C LCD1602(1602 Serial LCD Module Display\n-   8 x Jump wire\n\n------------------------------------------------------------------------",
                "char_count": 157,
                "token_estimate": 40
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "How to connect it to Arduino",
                "chunk_index": 5,
                "content": "-   Connect LCD1602 module to Arduino Uno board as following picture:\n\n| I2C LCD1602 | Arduino Uno board   |\n|-------------|---------------------|\n| GND         | GND                 |\n| VCC         | 5V                  |\n| SDA         | A4 \/pin 20 mega2560 |\n| SCL         | A5 \/pin 21 mega2560 |\n|             |                     |\n\n![ 500px \\| left ](Fritzing-sketch-for-LCD1602-and-Arduino.jpg \" 500px | left \")\n==How to connnect it to Raspberry Pi== ![ left \\|300px ](LCDGPIO.png \" left |300px \") ![ 300px \\| center ](Lcd1602blue03.jpg \" 300px | center \")\n==How to test it==\n\n-   Reference program writing:\n\n(The following program can recognize the screen used for 27 address and 3F address at the same time) Demo code in programming language C:\n\n#include <Wire.h>\n    #include <LiquidCrystal_I2C.h>",
                "char_count": 807,
                "token_estimate": 202
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "How to connect it to Arduino",
                "chunk_index": 6,
                "content": "void setup()\n    {\n        byte error;\n        Wire.begin();\n        Wire.beginTransmission(0x27);\n        error = Wire.endTransmission();\n        if(error == 0){                      \/\/ If your device is 0x27\n          LiquidCrystal_I2C lcd(0x27,20,4);\n          lcd.init();\n          lcd.backlight();\n          lcd.setCursor(0,0);\n          lcd.print(\"Device Addr = 0x27\");\n        }else{                               \/\/ If your device is 0x3F\n          LiquidCrystal_I2C lcd(0x3F,20,4);\n          lcd.init();\n          lcd.backlight();\n          lcd.setCursor(0,0);\n          lcd.print(\"Device Addr = 0x3F\");\n        }\n    }\n\nvoid loop(){}\n\n-   Compile it and run:\n\n<!-- -->\n\ngcc test_led1602.c\n    .\/a.out",
                "char_count": 710,
                "token_estimate": 178
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "How to program it in Arduino",
                "chunk_index": 7,
                "content": "-   1.Download the LiquidCrystal_I2C library\n-   2.Open the Arduino IDE,Select Sketch -\\> Include Library -\\> Add ZIP Library\n-   3.Find the file LiquidCrystal_I2C which you just download.\n-   4.Click it open and then you'll be prompted by \"Library added to your libraries.\n-   5.Check 'Import libraries'”.\n-   6.Open file -\\>Sketch-\\>Include Library-\\>LiquidCrystal_I2C.\n-   7.Copy the follwing code to the Arduino IDE ,click to the upload icon to upload the code to the control board:\n\n<!-- -->\n\n    #include <Wire.h>\n    #include <LiquidCrystal_I2C.h>\n\n    LiquidCrystal_I2C lcd(0x27, 16, 2); \/\/ set the LCD address to 0x27, if new version please use 0x3F instead.\n\n    void setup()\n    {\n      lcd.init();  \/\/initialize the lcd\n      lcd.backlight();  \/\/open the backlight\n    }\n\n    void loop()\n    {\n      lcd.setCursor(3, 0); \/\/ set the cursor to column 3, line 0\n      lcd.print(\"Hello GeeekPi\");  \/\/ Print a message to the LCD\n\n      lcd.setCursor(2, 1); \/\/ set the cursor to column 2, line 1\n      lcd.print(\"hello world\");  \/\/ Print a message to the LCD.\n    }",
                "char_count": 1071,
                "token_estimate": 268
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "How to program it on Raspberry Pi",
                "chunk_index": 8,
                "content": "-   ENABLE I2C ON THE PI\n\nBefore we get into the programming, we need to make sure the I2C module is enabled on the Pi and install a couple tools that will make it easier to use I2C.\n\n-   1\\. ENABLE I2C IN RASPI-CONFIG\n\nFirst, log in to your Pi and enter sudo raspi-config to access the configuration menu. Then arrow down and select “Advanced Settings”: <img src=\"I2csetup.jpg\" title=\"I2csetup.jpg\" width=\"500\" alt=\"I2csetup.jpg\" \/>\nNow arrow down and select “I2C Enable\/Disable automatic loading”: <img src=\"I2csetup2.jpg\" title=\"I2csetup2.jpg\" width=\"500\" alt=\"I2csetup2.jpg\" \/>\nChoose “Yes” at the next prompt, exit the configuration menu, and reboot the Pi to activate the settings.\n\n-   2.INSTALL I2C-TOOLS AND SMBUS",
                "char_count": 722,
                "token_estimate": 181
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "How to program it on Raspberry Pi",
                "chunk_index": 9,
                "content": "Now we need to install a program called I2C-tools, which will tell us the I2C address of the LCD when it’s connected to the Pi.\nSo at the command prompt, enter\n`sudo apt-get install i2c-tools`\nNext we need to install SMBUS, which gives the Python library we’re going to use access to the I2C bus on the Pi.\nAt the command prompt, enter `sudo apt-get install python-smbus`\nNow reboot the Pi and log in again.\nWith your LCD connected, enter `i2cdetect -y 1`\nat the command prompt. This will show you a table of addresses for each I2C device connected to your Pi:\n<img src=\"Lcd1602blue.jpg\" title=\"Lcd1602blue.jpg\" width=\"500\" alt=\"Lcd1602blue.jpg\" \/>\nThe I2C address of my LCD is 27. Take note of this number, we’ll need it later.\nCopy this code for the library, then save it in a file named I2C_LCD_driver.py:\n\n# -*- coding: utf-8 -*-\n\n# Original code found at:\n\n# https:\/\/gist.github.com\/DenisFromHR\/cc863375a6e19dce359d\n\n\"\"\"\n    Compiled, mashed and generally mutilated 2014-2015 by Denis Pleic\n    Made available under GNU GENERAL PUBLIC LICENSE\n\n# Modified Python I2C library for Raspberry Pi\n\n# as found on http:\/\/www.recantha.co.uk\/blog\/?p=4849",
                "char_count": 1149,
                "token_estimate": 288
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "How to program it on Raspberry Pi",
                "chunk_index": 10,
                "content": "# Joined existing 'i2c_lib.py' and 'lcddriver.py' into a single library\n\n# added bits and pieces from various sources\n\n# By DenisFromHR (Denis Pleic)\n\n# 2015-02-10, ver 0.1\n\n\"\"\"\n\n# i2c bus (0 -- original Pi, 1 -- Rev 2 Pi)\n\nI2CBUS = 0\n\n# LCD Address\n\nADDRESS = 0x27\n\nimport smbus\n    from time import sleep\n\nclass i2c_device:\n       def (self, addr, port=I2CBUS):\n          self.addr = addr\n          self.bus = smbus.SMBus(port)\n\n# Write a single command\n\ndef write_cmd(self, cmd):\n          self.bus.write_byte(self.addr, cmd)\n          sleep(0.0001)\n\n# Write a command and argument\n\ndef write_cmd_arg(self, cmd, data):\n          self.bus.write_byte_data(self.addr, cmd, data)\n          sleep(0.0001)\n\n# Write a block of data\n\ndef write_block_data(self, cmd, data):\n          self.bus.write_block_data(self.addr, cmd, data)\n          sleep(0.0001)\n\n# Read a single byte\n\ndef read(self):\n          return self.bus.read_byte(self.addr)\n\n# Read\n\ndef read_data(self, cmd):\n          return self.bus.read_byte_data(self.addr, cmd)\n\n# Read a block of data\n\ndef read_block_data(self, cmd):\n          return self.bus.read_block_data(self.addr, cmd)\n\n# commands",
                "char_count": 1154,
                "token_estimate": 289
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "How to program it on Raspberry Pi",
                "chunk_index": 11,
                "content": "LCD_CLEARDISPLAY = 0x01\n    LCD_RETURNHOME = 0x02\n    LCD_ENTRYMODESET = 0x04\n    LCD_DISPLAYCONTROL = 0x08\n    LCD_CURSORSHIFT = 0x10\n    LCD_FUNCTIONSET = 0x20\n    LCD_SETCGRAMADDR = 0x40\n    LCD_SETDDRAMADDR = 0x80\n\n# flags for display entry mode\n\nLCD_ENTRYRIGHT = 0x00\n    LCD_ENTRYLEFT = 0x02\n    LCD_ENTRYSHIFTINCREMENT = 0x01\n    LCD_ENTRYSHIFTDECREMENT = 0x00\n\n# flags for display on\/off control\n\nLCD_DISPLAYON = 0x04\n    LCD_DISPLAYOFF = 0x00\n    LCD_CURSORON = 0x02\n    LCD_CURSOROFF = 0x00\n    LCD_BLINKON = 0x01\n    LCD_BLINKOFF = 0x00\n\n# flags for display\/cursor shift\n\nLCD_DISPLAYMOVE = 0x08\n    LCD_CURSORMOVE = 0x00\n    LCD_MOVERIGHT = 0x04\n    LCD_MOVELEFT = 0x00\n\n# flags for function set\n\nLCD_8BITMODE = 0x10\n    LCD_4BITMODE = 0x00\n    LCD_2LINE = 0x08\n    LCD_1LINE = 0x00\n    LCD_5x10DOTS = 0x04\n    LCD_5x8DOTS = 0x00\n\n# flags for backlight control\n\nLCD_BACKLIGHT = 0x08\n    LCD_NOBACKLIGHT = 0x00\n\nEn = 0b00000100 # Enable bit\n\nRw = 0b00000010 # Read\/Write bit\n\nRs = 0b00000001 # Register select bit\n\nclass lcd:\n       #initializes objects and lcd\n       def (self):\n          self.lcd_device = i2c_device(ADDRESS)",
                "char_count": 1138,
                "token_estimate": 285
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "How to program it on Raspberry Pi",
                "chunk_index": 12,
                "content": "self.lcd_write(0x03)\n          self.lcd_write(0x03)\n          self.lcd_write(0x03)\n          self.lcd_write(0x02)\n\nself.lcd_write(LCD_FUNCTIONSET | LCD_2LINE | LCD_5x8DOTS | LCD_4BITMODE)\n          self.lcd_write(LCD_DISPLAYCONTROL | LCD_DISPLAYON)\n          self.lcd_write(LCD_CLEARDISPLAY)\n          self.lcd_write(LCD_ENTRYMODESET | LCD_ENTRYLEFT)\n          sleep(0.2)\n\n# clocks EN to latch command\n\ndef lcd_strobe(self, data):\n          self.lcd_device.write_cmd(data | En | LCD_BACKLIGHT)\n          sleep(.0005)\n          self.lcd_device.write_cmd(((data & ~En) | LCD_BACKLIGHT))\n          sleep(.0001)\n\ndef lcd_write_four_bits(self, data):\n          self.lcd_device.write_cmd(data | LCD_BACKLIGHT)\n          self.lcd_strobe(data)\n\n# write a command to lcd\n\ndef lcd_write(self, cmd, mode=0):\n          self.lcd_write_four_bits(mode | (cmd & 0xF0))\n          self.lcd_write_four_bits(mode | ((cmd << 4) & 0xF0))\n\n# write a character to lcd (or character rom) 0x09: backlight | RS=DR<\n\n# works!\n\ndef lcd_write_char(self, charvalue, mode=1):\n          self.lcd_write_four_bits(mode | (charvalue & 0xF0))\n          self.lcd_write_four_bits(mode | ((charvalue << 4) & 0xF0))",
                "char_count": 1174,
                "token_estimate": 294
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "How to program it on Raspberry Pi",
                "chunk_index": 13,
                "content": "# put string function with optional char positioning\n\ndef lcd_display_string(self, string, line=1, pos=0):\n        if line == 1:\n          pos_new = pos\n        elif line == 2:\n          pos_new = 0x40 + pos\n        elif line == 3:\n          pos_new = 0x14 + pos\n        elif line == 4:\n          pos_new = 0x54 + pos\n\nself.lcd_write(0x80 + pos_new)\n\nfor char in string:\n          self.lcd_write(ord(char), Rs)\n\n# clear lcd and set to home\n\ndef lcd_clear(self):\n          self.lcd_write(LCD_CLEARDISPLAY)\n          self.lcd_write(LCD_RETURNHOME)\n\n# define backlight on\/off (lcd.backlight(1); off= lcd.backlight(0)\n\ndef backlight(self, state): # for state, 1 = on, 0 = off\n\nif state == 1:\n             self.lcd_device.write_cmd(LCD_BACKLIGHT)\n          elif state == 0:\n             self.lcd_device.write_cmd(LCD_NOBACKLIGHT)\n\n# add custom characters (0 - 7)\n\ndef lcd_load_custom_chars(self, fontdata):\n          self.lcd_write(0x40);\n          for char in fontdata:\n             for line in char:\n                self.lcd_write_char(line)\n\nplease modify this paragraph according to your Pi version.\n\n# i2c bus (0 -- original Pi, 1 -- Rev 2 Pi)\n\nI2CBUS = 1",
                "char_count": 1155,
                "token_estimate": 289
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "Write to display",
                "chunk_index": 14,
                "content": "The following is a bare minimum “Hello World!” program to demonstrate how to initialize the LCD:\n\n    import I2C_LCD_driver\n    from time import *\n    mylcd = I2C_LCD_driver.lcd()\n    mylcd.lcd_display_string(\"Hello World!\", 1)\n\n<img src=\"Lcd1602exp.jpg\" title=\"Lcd1602exp.jpg\" width=\"500\" alt=\"Lcd1602exp.jpg\" \/>\n==POSITION THE TEXT== The function mylcd.lcd_display_string() prints text to the screen and also lets chose where to position it.\nThe function is used as mylcd.lcd_display_string(“TEXT TO PRINT”, ROW, COLUMN).\nThe following code prints “Hello World!” to row 2, column 3:\nOn a 16×2 LCD, the rows are numbered 1 – 2, while the columns are numbered 0 – 15.\nSo to print “Hello World!” at the first column of the top row, you would use:\n`mylcd.lcd_display_string(“Hello World!”, 1, 0)`\n==CLEAR THE SCREEN== The function mylcd.lcd_clear() clears the screen:\n\n    import I2C_LCD_driver\n    from time import *\n    mylcd = I2C_LCD_driver.lcd()\n    mylcd.lcd_display_string(\"This is how you\", 1)\n    sleep(1)\n    mylcd.lcd_clear()\n    mylcd.lcd_display_string(\"clear the screen\", 1)\n    sleep(1)\n    mylcd.lcd_clear()\n\n------------------------------------------------------------------------",
                "char_count": 1195,
                "token_estimate": 299
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "BLINKING TEXT",
                "chunk_index": 15,
                "content": "We can use a simple while loop with the mylcd.lcd_display_string() and mylcd.lcd_clear() functions to create a continuous blinking text effect:\n\n    import time\n    import I2C_LCD_driver\n    mylcd = I2C_LCD_driver.lcd()\n\n    while True:\n        mylcd.lcd_display_string(u\"Hello world!\")\n        time.sleep(1)\n        mylcd.lcd_clear()\n        time.sleep(1)\n\n------------------------------------------------------------------------\n\nYou can use the time.sleep() function on line 7 to change the time (in seconds) the text stays on.\nThe time the text stays off can be changed in the time.sleep() function on line 9.\nTo end the program, press Ctrl-C.",
                "char_count": 647,
                "token_estimate": 162
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "PRINT THE DATE AND TIME",
                "chunk_index": 16,
                "content": "The following program prints the current date and time to the LCD:\n\n    import I2C_LCD_driver\n    import time\n    mylcd = I2C_LCD_driver.lcd()\n\n    while True:\n        mylcd.lcd_display_string(\"Time: %s\" %time.strftime(\"%H:%M:%S\"), 1)\n\n        mylcd.lcd_display_string(\"Date: %s\" %time.strftime(\"%m\/%d\/%Y\"), 2)",
                "char_count": 310,
                "token_estimate": 78
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "PRINT YOUR IP ADDRESS",
                "chunk_index": 17,
                "content": "This code prints the IP address of your ethernet connection (eth0).\nTo print the IP of your WiFi connection, change eth0 to wlan0 in line 18:\n\n    import I2C_LCD_driver\n    import socket\n    import fcntl\n    import struct\n\n    mylcd = I2C_LCD_driver.lcd()\n\n    def get_ip_address(ifname):\n        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n        return socket.inet_ntoa(fcntl.ioctl(\n            s.fileno(),\n            0x8915,\n            struct.pack('256s', ifname[:15])\n        )[20:24])\n\n    mylcd.lcd_display_string(\"IP Address:\", 1)\n\n    mylcd.lcd_display_string(get_ip_address('eth0'), 2)",
                "char_count": 606,
                "token_estimate": 152
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "SCROLL TEXT RIGHT TO LEFT CONTINUOUSLY",
                "chunk_index": 18,
                "content": "This program will scroll a text string from the right side of the LCD to the left side and loop continuously:\n\n    import I2C_LCD_driver\n    from time import *\n\n    mylcd = I2C_LCD_driver.lcd()\n\n    str_pad = \" \" * 16\n    my_long_string = \"This is a string that needs to scroll\"\n    my_long_string = str_pad + my_long_string\n\n    while True:\n        for i in range (0, len(my_long_string)):\n            lcd_text = my_long_string[i:(i+16)]\n            mylcd.lcd_display_string(lcd_text,1)\n            sleep(0.4)\n            mylcd.lcd_display_string(str_pad,1)\n\n------------------------------------------------------------------------",
                "char_count": 632,
                "token_estimate": 158
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "SCROLL TEXT RIGHT TO LEFT ONCE",
                "chunk_index": 19,
                "content": "The following code slides text onto the screen from right to left once, then stops and leaves a cleared screen.\n\n    import I2C_LCD_driver\n    from time import *\n\n    mylcd = I2C_LCD_driver.lcd()\n\n    str_pad = \" \" * 16\n    my_long_string = \"This is a string that needs to scroll\"\n    my_long_string = str_pad + my_long_string\n\n    for i in range (0, len(my_long_string)):\n        lcd_text = my_long_string[i:(i+16)]\n        mylcd.lcd_display_string(lcd_text,1)\n        sleep(0.4)\n        mylcd.lcd_display_string(str_pad,1)\n\n------------------------------------------------------------------------",
                "char_count": 598,
                "token_estimate": 150
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "SCROLL TEXT LEFT TO RIGHT ONCE",
                "chunk_index": 20,
                "content": "This program slides text onto the screen from left to right once, then stops and leaves the first 16 characters of the text string on the screen.\n\n    import I2C_LCD_driver\n    from time import *\n\n    mylcd = I2C_LCD_driver.lcd()\n\n    padding = \" \" * 16\n    my_long_string = \"This is a string that needs to scroll\"\n    padded_string = my_long_string + padding\n\n    for i in range (0, len(my_long_string)):\n       lcd_text = padded_string[((len(my_long_string)-1)-i):-i]\n       mylcd.lcd_display_string(lcd_text,1)\n       sleep(0.4)\n       mylcd.lcd_display_string(padding[(15+i):i], 1)\n\n------------------------------------------------------------------------",
                "char_count": 659,
                "token_estimate": 165
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "CUSTOM CHARACTERS",
                "chunk_index": 21,
                "content": "You can create any pattern you want and print it to the display as a custom character.\nEach character is an array of 5 x 8 pixels.\nUp to 8 custom characters can be defined and stored in the LCD’s memory.\nThis custom character generator will help you create the bit array needed to define the characters in the LCD memory.\nlink: \\[ <https:\/\/omerk.github.io\/lcdchargen\/> \\|custom character generator \\]",
                "char_count": 400,
                "token_estimate": 100
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "PRINTING A SINGLE CUSTOM CHARACTER",
                "chunk_index": 22,
                "content": "The following code generates a “\\<” character:\n\n    import I2C_LCD_driver\n    from time import *\n\n    mylcd = I2C_LCD_driver.lcd()\n\n    fontdata1 = [\n            [ 0b00010,\n              0b00100,\n              0b01000,\n              0b10000,\n              0b01000,\n              0b00100,\n              0b00010,\n              0b00000 ],\n    ]\n\n    mylcd.lcd_load_custom_chars(fontdata1)\n    mylcd.lcd_write(0x80)\n    mylcd.lcd_write_char(0)",
                "char_count": 439,
                "token_estimate": 110
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "PRINTING MULTIPLE CUSTOM CHARACTERS",
                "chunk_index": 23,
                "content": "This program prints a large right pointing arrow (→) to the screen:\n\nimport I2C_LCD_driver\n    from time import *\n\nmylcd = I2C_LCD_driver.lcd()\n\nfontdata1 = [\n            # char(0) - Upper-left character\n\n[ 0b00000,\n              0b00000,\n              0b00000,\n              0b00000,\n              0b00000,\n              0b00000,\n              0b11111,\n              0b11111 ],\n\n# char(1) - Upper-middle character\n\n[ 0b00000,\n              0b00000,\n              0b00100,\n              0b00110,\n              0b00111,\n              0b00111,\n              0b11111,\n              0b11111 ],\n\n# char(2) - Upper-right character\n\n[ 0b00000,\n              0b00000,\n              0b00000,\n              0b00000,\n              0b00000,\n              0b00000,\n              0b10000,\n              0b11000 ],\n\n# char(3) - Lower-left character\n\n[ 0b11111,\n              0b11111,\n              0b00000,\n              0b00000,\n              0b00000,\n              0b00000,\n              0b00000,\n              0b00000 ],\n\n# char(4) - Lower-middle character",
                "char_count": 1044,
                "token_estimate": 261
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "PRINTING MULTIPLE CUSTOM CHARACTERS",
                "chunk_index": 24,
                "content": "[ 0b11111,\n              0b11111,\n              0b00111,\n              0b00111,\n              0b00110,\n              0b00100,\n              0b00000,\n              0b00000 ],\n\n# char(5) - Lower-right character\n\n[ 0b11000,\n              0b10000,\n              0b00000,\n              0b00000,\n              0b00000,\n              0b00000,\n              0b00000,\n              0b00000 ],\n    ]\n\nmylcd.lcd_load_custom_chars(fontdata1)\n\nmylcd.lcd_write(0x80)\n    mylcd.lcd_write_char(0)\n    mylcd.lcd_write_char(1)\n    mylcd.lcd_write_char(2)\n\nmylcd.lcd_write(0xC0)\n    mylcd.lcd_write_char(3)\n    mylcd.lcd_write_char(4)\n    mylcd.lcd_write_char(5)",
                "char_count": 643,
                "token_estimate": 161
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "PRINT DATA FROM A SENSOR",
                "chunk_index": 25,
                "content": "The code below will display data from a DHT11 temperature and humidity sensor.\nFollow this tutorial for instructions on how to set up the DHT11 on the Raspberry Pi.\nThe DHT11 signal pin is connected to BCM pin 4 (physical pin 7 of the RPi).\nTemperature is displayed on line 1, and humidity on line 2:\n\nimport RPi.GPIO as GPIO\n    import dht11\n    import I2C_LCD_driver\n\nfrom time import *\n\nmylcd = I2C_LCD_driver.lcd()\n\nGPIO.setwarnings(False)\n    GPIO.setmode(GPIO.BCM)\n    GPIO.cleanup()\n\nwhile True:\n        instance = dht11.DHT11(pin = 4)\n        result = instance.read()\n\n# Uncomment for Fahrenheit:\n\n# result.temperature = (result.temperature * 1.8) + 32\n\nif result.is_valid():\n            mylcd.lcd_display_string(\"Temp: %d%s C\" % (result.temperature, chr(223)), 1)\n            mylcd.lcd_display_string(\"Humidity: %d %%\" % result.humidity, 2)\n\n------------------------------------------------------------------------",
                "char_count": 923,
                "token_estimate": 231
            },
            {
                "title": "Z-0234",
                "rev_id": 12960,
                "heading_path": "PRINT DATA FROM A SENSOR",
                "chunk_index": 26,
                "content": "For Fahrenheit, un-comment lines 18 and 19, and change the C to an F in line 22.\nYou can also change the signal pin of the DHT11 input in line 15.\nBy inserting the variable from your sensor into the mylcd.lcd_display_string() function (line 22 in the code above) you can print the sensor data just like any other text string.\nThese programs are just basic examples of ways you can control text on your LCD.\nTry changing things around and combining the code to get some cool effects.\nFor example, you can make some interesting animations by scrolling with custom characters.\nDon’t have enough screen space to output all of your sensor data?\nJust print and clear each reading for a couple seconds in a loop.",
                "char_count": 705,
                "token_estimate": 177
            }
        ]
    }
}