LCD Pin Function Pi Function Pi Pin
01 GND GND P1-06
02 +5V +5V P1-02
03 Contrast
04 RS GPIO7 P1-26
05 RW GND P1-06
06 E GPIO8 P1-24
07 Data 0
08 Data 1
09 Data 2
10 Data 3
11 Data 4 GPIO25 P1-22
12 Data 5 GPIO24 P1-18
13 Data 6 GPIO23 P1-16
14 Data 7 GPIO18 P1-12
15 +5V via 560 ohm
16 GND P1-06
Устанавливаю библиотеку RPi.GPIO для работы с GPIO адаптированную для BPI. С начало ставлю библиотеку для banana Pi, а затем для banana PRO.
git clone https://github.com/LeMaker/RPi.GPIO_BP -b bananapi apt-get update apt-get install python-dev cd /RPi.GPIO_BP setup.py install git clone https://github.com/LeMaker/RPi.GPIO_BP -b bananapro apt-get update apt-get install python-dev cd /RPi.GPIO_BP setup.py install
Скачиваю скрипты и перехожу в папку со скриптами для работы с LCD
apt-get install git git clone git://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code.git cd Adafruit-Raspberry-Pi-Python-Code cd Adafruit_CharLCD
cat Adafruit_CharLCD_IPclock_example.py #!/usr/bin/python from Adafruit_CharLCD import Adafruit_CharLCD from subprocess import * from time import sleep, strftime from datetime import datetime lcd = Adafruit_CharLCD() cmd = "ip addr show eth0 | grep 'inet ' | awk '{print $2}' | cut -d/ -f1" lcd.begin(16, 1) def run_cmd(cmd): p = Popen(cmd, shell=True, stdout=PIPE) output = p.communicate()[0] return output while 1: lcd.clear() ipaddr = run_cmd(cmd) lcd.message(datetime.now().strftime('%b %d %H:%M:%S\n')) lcd.message('IP %s' % (ipaddr)) sleep(1)
ссылки:
https://github.com/LeMaker/RPi.GPIO_BP
http://wiki.lemaker.org/BananaPro/Pi:GPIO_library
http://wiki.lemaker.org/RPi.GPIO
https://learn.adafruit.com/drive-a-16x2-lcd-directly-with-a-raspberry-pi/python-code
http://www.raspberrypi-spy.co.uk/2012/07/16x2-lcd-module-control-using-python
https://projects.drogon.net/raspberry-pi/wiringpi/lcd-library
http://raspberrypi.ru/blog/readblog/530.html
https://github.com/sweetpi/python-i2c-lcd
http://www.recantha.co.uk/blog/?p=4849