--Use Adafruit's Python library to display characters on a 16x2-digit character LCD known as 1602.
https://github.com/adafruit/Adafruit_Python_CharLCD
--It's not an I2C connection **
--Any pin that can be used as GPIO on Raspberry Pi can be connected.
2017-04-10-raspbian-jessie
--sudo apt-get update && sudo apt-get upgrade
, Linux raspberrypi 4.9.24-v7 + # 993 SMP Wed Apr 26 18:01:23 BST 2017 armv7l GNU / Linux
LCD Pin :Raspberry Pi pin
1 VSS * GND
2 VDD * 5.0V
3 V0 * (To the pin in the middle of the 10KΩ variable resistor. 5 at both ends of the variable resistor.0V and GND)
4 RS : GPIO22 (15th Pin)
5 RW : GND (H=Read/L=Since it is Write, Write Only)
6 E : GPIO26 (No. 37 Pin)
7 D0 -Do not use NC
8 D1 -Do not use NC
9 D2 -Do not use NC
10 D3 -Do not use NC
11 D4 : GPIO5 (29th Pin)
12 D5 : GPIO6 (31st Pin)
13 D6 : GPIO13 (33rd Pin)
14 D7 : GPIO19 (No. 35 Pin)
15 A * 5.0V
16 K * GND
sudo apt-get update
sudo apt-get install -y build-essential python-dev python-smbus python-pip git
sudo pip install RPi.GPIO
#
cd $HOME
#Git, Kuro-n.
git clone https://github.com/adafruit/Adafruit_Python_CharLCD.git
#
cd Adafruit_Python_CharLCD
#Installation
sudo python setup.py install
Start Python with python
[Enter]
Code, copy
#Import this guy. import Adafruit_CharLCD as LCD #Pin settings.Enter the GPIO number lcd_rs = 22 lcd_en = 26 lcd_d4 = 5 lcd_d5 = 6 lcd_d6 = 13 lcd_d7 = 19
#16x2 digits. lcd_columns = 16 lcd_rows = 2
lcd = LCD.Adafruit_CharLCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7, lcd_columns, lcd_rows) #LCD clear. lcd.clear() #Message display. lcd.message('Hello World!16x2\nQiita.com/mt08/') #Display the cursor and blink lcd.blink(True)
3. Exit with `Ctrl-D`
## Other
--When running ʻAdafruit_Python_CharLCD / examples / char_lcd.py`, open it in a text editor and change the pin settings to a good one.
――I have 5V, but is GPIO okay ?? <br> ... Maybe. .. .. Since the RW pin is set to GND and it is written only from the perspective of Raspberry Pi, it will not be output from the LCD side ...
-If you look at [ʻAdafruit_CharLCD / Adafruit_CharLCD.py`](https://github.com/adafruit/Adafruit_Python_CharLCD/blob/master/Adafruit_CharLCD/Adafruit_CharLCD.py), you can see the commands that you can use ... `def` So you define it, right?
--If you look at the WiringPi (http://wiringpi.com/dev-lib/lcd-library/), does C support it? Like
### Execution example
```py
pi@raspberrypi:~ $ python
Python 2.7.9 (default, Sep 17 2016, 20:26:04)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> #Import this guy.
... import Adafruit_CharLCD as LCD
>>> #Pin settings.Enter the GPIO number
... lcd_rs = 22
>>> lcd_en = 26
>>> lcd_d4 = 5
>>> lcd_d5 = 6
>>> lcd_d6 = 13
>>> lcd_d7 = 19
>>> #
... #16x2 digits.
... lcd_columns = 16
>>> lcd_rows = 2
>>> #
... #
... lcd = LCD.Adafruit_CharLCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7,
... lcd_columns, lcd_rows)
>>> #LCD clear.
... lcd.clear()
>>> #Message display.
... lcd.message('Hello World!16x2\nQiita.com/mt08/')
>>> #Display the cursor and blink
... lcd.blink(True)
>>>
pi@raspberrypi:~ $