Coder Social home page Coder Social logo

dbrgn / rplcd Goto Github PK

View Code? Open in Web Editor NEW
259.0 18.0 70.0 907 KB

A Raspberry Pi LCD library for the widely used Hitachi HD44780 controller, written in Python. GPIO (parallel) and I²C modes supported.

Home Page: https://rplcd.readthedocs.io/en/latest/

License: MIT License

Python 100.00%

rplcd's Introduction

RPLCD

Build Status PyPI Version PyPI Wheel PyPI Python Versions Dependencies License

A Python 3 Raspberry PI Character LCD library for the Hitachi HD44780 controller. It supports both GPIO (parallel) mode as well as boards with an I²C port expander (e.g. the PCF8574 or the MCP23008).

This library is inspired by Adafruit Industries' CharLCD library as well as by Arduino's LiquidCrystal library.

For GPIO mode, no external dependencies (except the RPi.GPIO library, which comes preinstalled on Raspbian) are needed to use this library. If you want to control LCDs via I²C, then you also need the python-smbus or smbus2 library. If you want to control the LCD with pigpio, you have to install the pigpio library.

If you're trying to get started with RPLCD, you should probably read the docs :)

Photo of 20x4 LCD in action

Setup

You can install RPLCD directly from PyPI using pip:

$ sudo pip install RPLCD

If you want to use I²C, you also need either the smbus or smbus2 library:

$ sudo apt install python-smbus
or
$ sudo pip install smbus2

RPLCD will first try to use smbus if available and if not, fall back to smbus2.

You can also install the library manually without pip. Either just copy the scripts to your working directory and import them, or download the repository and run python setup.py install to install it into your Python package directory.

Features

Implemented

  • Simple to use API
  • Support for both 4 bit and 8 bit modes
  • Support for both parallel (GPIO) and I²C connection
  • Support for custom characters
  • Support for backlight control circuits
  • Built-in support for A00, A02 (standard HD44780) or ST0B (see ST7066, page 11) character tables
  • Caching: Only write characters if they changed
  • No external dependencies (except RPi.GPIO, and python-smbus or smbus2 if you need I²C support)

Wishlist

These things may get implemented in the future, depending on my free time and motivation:

  • MicroPython port

Supported I²C Port Expanders

  • PCF8574 (used by a lot of I²C LCD adapters on Ali Express)
  • MCP23008 (used in Adafruit I²C LCD backpack)
  • MCP23017

Documentation

Testing

Interactive Test Script

To test your LCD, please run the rplcd-tests script with the testsuite target.

Unit Tests

There are also unit tests. First, install dependencies:

pip install -U -r requirements-dev.txt

Then run the tests:

py.test -v

Coding Guidelines

PEP8 via flake8 with max-line-width set to 99 and E126-E128,C901 ignored:

flake8 --max-line-length=99 --ignore=E126,E127,E128,C901 RPLCD/lcd.py

About HD44780

The HD44780 LCD controller is a controller chip for driving alphanumeric LCD displays. Though it's not manufactured anymore there are a lot of compatible chips / clones of it e.g. the ST7066 or the KS0066. Displays sold with 'HD44780' in its name today typically are built with one of those clones, though they all look the same from the outside most of the time (like in the image at the start of this README).

Resources

License

This code is licensed under the MIT license, see the LICENSE file or tldrlegal for more information.

rplcd's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rplcd's Issues

Offset line 3 and 4

Hey, first of all, your library is great, but I have a problem with it.
I already worked with this LCD (16x4) with the Arduino, and I had the same problem there, the 3rd and 4th line is offset by 4 characters, so where a letter would be in the first col, it is in the 4th col. Back with the Arduino, I fixed it by changing the RAM addresses for every single line, whereas the original address in the code was 0xXX, and I needed to change it to 0xYY (sorry, don't remember the values), which can be looked up in the datasheet of the LCD. So I searched through your code, but I didn't find any variable to specify the RAM adress for line 3 and 4, so could you add such variables in the code? Would be very handy, thanks!

Edit: If I write something in the 3rd line, it is offset 4 cols, as I said. If I shift the display then by -4, so 4 cols behind, the 3rd and 4th lines are then perfect..

20 x 4 demo typo

When I run the 20x4 test it actually reports this:

diff --git a/test_20x4.py b/test_20x4.py
index 70c6d58..854f386 100755
--- a/test_20x4.py
+++ b/test_20x4.py
@@ -127,8 +127,8 @@ lcd.write_string('12345678901234567890\r\n2nd line')
 input('The first line should be filled with numbers, the second line should show "2nd line"')
 
 lcd.clear()
-lcd.write_string('999456..............\n\r\n\n\n123')
-input('The display should show "123456...................." on the first line')
+lcd.write_string('123456..............\n\r\n\n\n123')
+input('The display should show "123456...................." on the first line and "123" on the last line')
 
 lcd.clear()
 lcd.backlight = False

Scroll text vertically

Is there any way I can scroll text vertically on my 20x4 lcd? Like the first line goes away and the next line appears down, and so on?

test_20x4.py i2c on Raspberry pi 1

Im using a pi1, I have to use i2cdetect 0 to get my i2c address of 0x27. In your docs you mention i2cdetect 1, so im assuming there is a variable to tell the framework that im using a Pi 1 and to look in the right place.

I have no idea if im using MCP23008 or PCF8574, but BOTH return the same errors in python.

tom@raspberrypi:~/python $ sudo python3 test_20x4.py i2c MCP23008 0x27 A02
Traceback (most recent call last):
  File "test_20x4.py", line 56, in <module>
    lcd = i2c.CharLCD(sys.argv[2], int(sys.argv[3], 16), cols=20, rows=4, charmap=sys.argv[4])
  File "/usr/local/lib/python3.4/dist-packages/RPLCD/i2c.py", line 79, in __init__
    auto_linebreaks=auto_linebreaks)
  File "/usr/local/lib/python3.4/dist-packages/RPLCD/lcd.py", line 94, in __init__
    self._init_connection()
  File "/usr/local/lib/python3.4/dist-packages/RPLCD/i2c.py", line 85, in _init_connection
    self.bus = SMBus(self.port)
FileNotFoundError: [Errno 2] No such file or directory

Current version in git installer seems broken

On a fresh install from git:


pi@testpi:~$ sudo pip3 install git+https://github.com/dbrgn/RPLCD.git
Collecting git+https://github.com/dbrgn/RPLCD.git
  Cloning https://github.com/dbrgn/RPLCD.git to /tmp/pip-vatij0r9-build
Installing collected packages: RPLCD
  Running setup.py install for RPLCD ... done
Successfully installed RPLCD-0.4.0

Traceback (most recent call last):
  File "test_20x4.py", line 7, in <module>
    from RPLCD import gpio, i2c
  File "/usr/local/lib/python3.4/dist-packages/RPLCD/__init__.py", line 5, in <module>
    from .gpio import CharLCD as GpioCharLCD
  File "/usr/local/lib/python3.4/dist-packages/RPLCD/gpio.py", line 30, in <module>
    from .lcd import BaseCharLCD
  File "/usr/local/lib/python3.4/dist-packages/RPLCD/lcd.py", line 27, in <module>
    from . import codecs
ImportError: cannot import name 'codecs'

Somehow, the codecs directory isn't getting created. I suspect that the setuptools dependency resolution isn't detecting the codecs files.

I manually cloned the repository, and the problem still occurs:

130 pi@testpi:~$ git clone https://github.com/dbrgn/RPLCD.git
Cloning into 'RPLCD'...
remote: Counting objects: 667, done.
remote: Total 667 (delta 0), reused 0 (delta 0), pack-reused 667
Receiving objects: 100% (667/667), 569.38 KiB | 967.00 KiB/s, done.
Resolving deltas: 100% (374/374), done.
Checking connectivity... done.
pi@testpi:~$ cd RPLCD/
pi@testpi:~/RPLCD$ ls
CHANGELOG.md  CONTRIBUTING.md  CONTRIBUTORS  docs  LICENSE  MANIFEST.in  photo-i2c.jpg  photo.jpg  pytest.ini  README.rst  requirements-dev.txt  RPLCD  setup.cfg  setup.py  show_charmap.py  test_16x2.py  test_20x4.py  tests
pi@testpi:~/RPLCD$ sudo python3 setup.py install
running install
running bdist_egg
running egg_info
creating RPLCD.egg-info
writing top-level names to RPLCD.egg-info/top_level.txt
writing dependency_links to RPLCD.egg-info/dependency_links.txt
writing RPLCD.egg-info/PKG-INFO
writing manifest file 'RPLCD.egg-info/SOURCES.txt'
reading manifest file 'RPLCD.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*.pyc' found under directory '*'
writing manifest file 'RPLCD.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-armv7l/egg
running install_lib
running build_py
creating build
creating build/lib
creating build/lib/RPLCD
copying RPLCD/i2c.py -> build/lib/RPLCD
copying RPLCD/lcd.py -> build/lib/RPLCD
copying RPLCD/enum.py -> build/lib/RPLCD
copying RPLCD/contextmanagers.py -> build/lib/RPLCD
copying RPLCD/compat.py -> build/lib/RPLCD
copying RPLCD/gpio.py -> build/lib/RPLCD
copying RPLCD/common.py -> build/lib/RPLCD
copying RPLCD/__init__.py -> build/lib/RPLCD
creating build/bdist.linux-armv7l
creating build/bdist.linux-armv7l/egg
creating build/bdist.linux-armv7l/egg/RPLCD
copying build/lib/RPLCD/i2c.py -> build/bdist.linux-armv7l/egg/RPLCD
copying build/lib/RPLCD/lcd.py -> build/bdist.linux-armv7l/egg/RPLCD
copying build/lib/RPLCD/enum.py -> build/bdist.linux-armv7l/egg/RPLCD
copying build/lib/RPLCD/contextmanagers.py -> build/bdist.linux-armv7l/egg/RPLCD
copying build/lib/RPLCD/compat.py -> build/bdist.linux-armv7l/egg/RPLCD
copying build/lib/RPLCD/gpio.py -> build/bdist.linux-armv7l/egg/RPLCD
copying build/lib/RPLCD/common.py -> build/bdist.linux-armv7l/egg/RPLCD
copying build/lib/RPLCD/__init__.py -> build/bdist.linux-armv7l/egg/RPLCD
byte-compiling build/bdist.linux-armv7l/egg/RPLCD/i2c.py to i2c.cpython-34.pyc
byte-compiling build/bdist.linux-armv7l/egg/RPLCD/lcd.py to lcd.cpython-34.pyc
byte-compiling build/bdist.linux-armv7l/egg/RPLCD/enum.py to enum.cpython-34.pyc
byte-compiling build/bdist.linux-armv7l/egg/RPLCD/contextmanagers.py to contextmanagers.cpython-34.pyc
byte-compiling build/bdist.linux-armv7l/egg/RPLCD/compat.py to compat.cpython-34.pyc
byte-compiling build/bdist.linux-armv7l/egg/RPLCD/gpio.py to gpio.cpython-34.pyc
byte-compiling build/bdist.linux-armv7l/egg/RPLCD/common.py to common.cpython-34.pyc
byte-compiling build/bdist.linux-armv7l/egg/RPLCD/__init__.py to __init__.cpython-34.pyc
creating build/bdist.linux-armv7l/egg/EGG-INFO
copying RPLCD.egg-info/PKG-INFO -> build/bdist.linux-armv7l/egg/EGG-INFO
copying RPLCD.egg-info/SOURCES.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying RPLCD.egg-info/dependency_links.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
copying RPLCD.egg-info/top_level.txt -> build/bdist.linux-armv7l/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/RPLCD-0.4.0-py3.4.egg' and adding 'build/bdist.linux-armv7l/egg' to it
removing 'build/bdist.linux-armv7l/egg' (and everything under it)
Processing RPLCD-0.4.0-py3.4.egg
Copying RPLCD-0.4.0-py3.4.egg to /usr/local/lib/python3.4/dist-packages
Adding RPLCD 0.4.0 to easy-install.pth file

Installed /usr/local/lib/python3.4/dist-packages/RPLCD-0.4.0-py3.4.egg
Processing dependencies for RPLCD==0.4.0
Finished processing dependencies for RPLCD==0.4.0


130 pi@testpi:~$ python3
Python 3.4.2 (default, Oct 19 2014, 13:31:11)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import RPLCD
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.4/dist-packages/RPLCD-0.4.0-py3.4.egg/RPLCD/__init__.py", line 5, in <module>
  File "/usr/local/lib/python3.4/dist-packages/RPLCD-0.4.0-py3.4.egg/RPLCD/gpio.py", line 30, in <module>
  File "/usr/local/lib/python3.4/dist-packages/RPLCD-0.4.0-py3.4.egg/RPLCD/lcd.py", line 27, in <module>
ImportError: cannot import name 'codecs'

ST7066U

Hi, it's possible to drive an LCD with ST7066U controller?

need help

hi all
using arduino

i need program reads binary bits from 16 bit up to 128 in serial

and convert the bits to decimal using the command tvout

any one can help please

Setup code does not work on Python 3.5.3

Launching up the code and it works beautifully on python 2.7.13 but everything I run on 3.5.3 has the same error message even when I only put in the provided setup code. (Yes my lcd i2c address was 0x27)
I run this code

from RPLCD.i2c import CharLCD
lcd = CharLCD(i2c_expander='PCF8574', address=0x27, port=1,
              cols=20, rows=4, dotsize=8,
              charmap='A02',
              auto_linebreaks=True,
              backlight_enabled=True)

and it always gives the error

Traceback (most recent call last):
  File "/home/pi/Screen.py", line 6, in <module>
    backlight_enabled=True)
  File "/home/pi/.local/lib/python3.5/site-packages/RPLCD/i2c.py", line 164, in __init__
    auto_linebreaks=auto_linebreaks)
  File "/home/pi/.local/lib/python3.5/site-packages/RPLCD/lcd.py", line 99, in __init__
    self.command(0x03)
  File "/home/pi/.local/lib/python3.5/site-packages/RPLCD/lcd.py", line 377, in command
    self._send_instruction(value)
  File "/home/pi/.local/lib/python3.5/site-packages/RPLCD/i2c.py", line 237, in _send_instruction
    (value & 0xF0)) | self._backlight)
OSError: [Errno 121] Remote I/O error
>>> 

on python 3.5.3 but it works perfectly fine on python 2.7.13
Not really sure what is going on here. I am running a Pi 3 Model B V1.2
If anything needs clarification drop a comment and if I am posting this in the wrong area tell me where I should be posting it.

Wrapper for unichr

To make it easier to understand, a custom wrapper for unichr could be created. It could be named CustomChar.

So this code

>>> lcd.create_char(0, smiley)
>>> lcd.write_string(unichr(0))

becomes

>>> lcd.create_char(0, smiley)
>>> lcd.write_string(CustomChar(0))

We could even return it from the create_char function:

>>> smiley_char = lcd.create_char(0, smiley)
>>> lcd.write_string(smiley_char)

It would behave like a unicode object, so it could be concatenated:

>>>> lcd.write_string(u'Hello ' + smiley_char)

RPIO.setup(self.pins.rs, mode)

I think line 446 RPIO.setup(self.pins.rs, mode) should be RPIO.output(self.pins.rs, mode)

I've connected a LCD to a Pi using a darlington array (to protect the Pi). So in my case all pins were inverted.
So I changed all RPIO.output([pin], [value]) to RPIO.output([pin], not [value]). But that didn't seem to work. Then I spotted the line RPIO.setup(self.pins.rs, mode) (line 446). After changing setup to output the LCD came to life.

Now it seems to work fine on my 20x2 display. So thank you for sharing your code.

Compatible LCDs

What about adding a list of tested devices/controllers in the README? I know there are minor differences, although devices are HD44780 compatible. Commands are usually not a problem, but addresses (such as CGRAM) could be.

Unexpected keyword argument "numbering_mode"

When using the following code, I get this error message:

Traceback (most recent call last):
File "./test.py", line 9, in
charmap='A02',auto_linebreaks=True)
TypeError: init() got an unexpected keyword argument 'numbering_mode'

code:

from RPLCD.i2c import CharLCD
import RPi.GPIO as GPIO

lcd = CharLCD(  pin_rs=12, pin_rw=6, pin_e=17, pins_data=[18, 22, 23, 24],
                numbering_mode=GPIO.BCM,
                cols=16,rows=2,dotsize=8,
                charmap='A02',auto_linebreaks=True)

Convenience functions for newline / carriage return

Convenience functions. Easier to use than write_string('\n') or cursor_pos = (cursor_pos.row + 1, cursor_pos.col).

def nl():
    ...

def cr():
    ...

Or should they be spelled as newline and carriage_return instead?

Support for 40x4 LCD?

Thank you for your gread LCD library!

Is it possible to use a 40x2 LCD? My guess is, it's not possible, since these LCDs need two enable lines and CharLCD.__init__ only has one pin_e keyword …

Do you plan to add support for these LCDs? Thanks.

+5V and GND pins reversed

Under the section Wiring up Pi with LCD display the pins 1 and 2 are reversed. It says that pin 1 should be connected to the plus and pin 2 to GND but as far as I know and have tested, it should be reversed. Pin 1 is Vss and thus ground, pin2 is Vdd and thus plus (5 volt).

cannot import CursorMode

I'm using Raspberry pi 3 with Rasbian and I just follow this tutorial : http://www.circuitbasics.com/raspberry-pi-lcd-set-up-and-programming-in-python/

When I write

from RPLCD import CharLCD
from RPLCD import CursorMode

I get this error
ImportError: cannot import name CursorMode

I've tried with Python 2.7.13 and Python 3.5.3, but both give same error.
I've already reinstall library but no any difference.
Do you have any advises?
(aside from this problem, it can show the text on lcd display without any problem )

Stable docs

Once 1.0.0 is released, set up docs so that stable points to the release version.

Runtime warning

Hello,

I have got this code working, why such warning appeared?

pi@raspberrypi:~/PythonStuff/LCD16x2 $ sudo python rplcd.py
/usr/local/lib/python2.7/dist-packages/RPLCD/lcd.py:191: RuntimeWarning: This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.
  GPIO.setup(pin, GPIO.OUT)

CursorMode Not Working

Hey, I was interfacing my LCD with RPi and used this library but when i run the code below it gives me the error. 'ImportError: cannot import name 'CursorMode'. If this is changed to something else how can i get it working?

from RPLCD import CharLCD
from RPLCD import CursorMode
import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BOARD)
GPIO.setup(33,GPIO.OUT)
GPIO.setup(31,GPIO.OUT)
GPIO.setup(29,GPIO.OUT)
GPIO.setup(23,GPIO.OUT)

lcd=CharLCD(numbering_mode=GPIO.BOARD, pin_rs=37, pin_e=35, rows=2, cols=16, pins_data=[33,31,29,23])
try:
    lcd.clear()
    lcd.cursor_pos = (0, 0)
    lcd.write_string(u'This Is My First\n\rLCD Interfacing!')
    lcd.cursor_mode = CursorMode.blink
except:
    pass

finally:
    GPIO.cleanup()

Any help is greatly appreciated. Thank You!

Getting Garbage Display

WHen doing several updates in a row, the output on the LCD becomes corrupted. Garbage characters and the only way out is a full reset. This is the relevant code:

        lcd.clear()
        lcd.cursor_pos = (0, lineStartPos(lcdLine1))
        lcd.write_string(str(lcdLine1))
        lcd.cursor_pos = (1, lineStartPos(lcdLine2))
        lcd.write_string(str(lcdLine2))
        lcd.cursor_pos = (2, lineStartPos(lcdLine3))
        lcd.write_string(str(lcdLine3))
        lcd.cursor_pos = (3, 0)
        lcd.write_string("Target:")
        lcd.write_string(str(targetTemp))
        lcd.write_string(chr(223) + " ")
        lcd.write_string("Temp:")
        lcd.write_string(str(currentTemp))
        lcd.write_string(chr(223))

lineStartPos is a function to determine center point of the text. I can update the same content perhaps 6 times in a row but after that it becomes corrupt. Thanks.

Busy flag checking

Check busy flag before writing a command.

Be careful not to put 5v from the LCD into the 3.3v GPIO ports.

Bundle test script

Right now the packaging is a bit broken: The lcdtests package is packaged too, but without the lcdtest.py script.

We should probably create a separate package (called RPLCD_test or something like that) that will be bundled with the main library and make sure that the test script is automatically installed in the PATH for the user, so that the tests can be run after a pip install from PyPI too.

No module (After installing) error messages.

I installed Via PIP as required and I already have python-smbus installed.
I seem to have python2 and python3 on my Pi, I didnt have pip so I had to install it using sudo easy_install3 pip.

Installing this:

tom@raspberrypi:~/python $ sudo pip install RPLCD
Collecting RPLCD
  Downloading RPLCD-0.9.0-py2.py3-none-any.whl
Installing collected packages: RPLCD
Successfully installed RPLCD-0.9.0

I then wget the test_20x4.py and ran it under both python2 and python3. Neither work.

tom@raspberrypi:~/python $ sudo python test_20x4.py
Traceback (most recent call last):
  File "test_20x4.py", line 28, in <module>
    from RPLCD import gpio, i2c
ImportError: No module named RPLCD
tom@raspberrypi:~/python $ sudo python3 test_20x4.py
Traceback (most recent call last):
  File "test_20x4.py", line 28, in <module>
    from RPLCD import gpio, i2c
  File "/usr/local/lib/python3.4/dist-packages/RPLCD/__init__.py", line 5, in <module>
    from .gpio import CharLCD as GpioCharLCD
  File "/usr/local/lib/python3.4/dist-packages/RPLCD/gpio.py", line 27, in <module>
    import RPi.GPIO as GPIO
ImportError: No module named 'RPi'

Defaults for gpio

The default pins for gpio should be removed.
Its really dangerous. I have accidentially run code several times with default pins. And with sensors, motordrivers etc connected to the pi. Im just lucky that nothing broke.

The user should explicitly have to set these manually.

These defaults seem obsolete from the beginning of the project with only one configuration.

Also. Gpio mode GPIO.BOARD as defaults should be removed or changed to GPIO.BCM that is way more used. Cant actually remember to have seen a project with GPIO.BOARD as default.

Can't seem to use? Keeps saying no module?

Apologies as I am a total noob, but I am trying to use this and I keep getting an error message when running this code:

from RPLCD.gpio import CharLCD
lcd = CharLCD(cols=16, rows=2, pin_rs=37, pin_e=35, pins_data=[40, 38, 36, 32, 33, 31, 29, 23])
lcd.write_string(u'Hello!')

This is my error message, and I have followed the PIP installation process...

Traceback (most recent call last):
File "/home/pi/Desktop/Pi Projects/LCD Control Basics.py", line 1, in
from RPLCD.gpio import CharLCD
ImportError: No module named 'RPLCD'

Can you tell me what I am doing wrong?

Fix deprecation warnings

Fix these:

RPLCD/lcd.py:109: DeprecationWarning: int() is deprecated; use IntEnums
  self._cursor_mode = int(c.CursorMode.hide)
RPLCD/lcd.py:117: DeprecationWarning: int() is deprecated; use IntEnums
  self._text_align_mode = int(c.Alignment.left)
RPLCD/lcd.py:118: DeprecationWarning: int() is deprecated; use IntEnums
  self._display_shift_mode = int(c.ShiftMode.cursor)

BCM numbering mode

When trying to use BCM numbering mode I get the following error

  File "/usr/local/lib/python2.7/dist-packages/RPLCD/lcd.py", line 211, in __init__
    GPIO.setmode(self.numbering_mode)
ValueError: A different mode has already been set!

Is this expected behavior or should I be able to use BCM numbering?

shifted 3rd and 4th lines in 16x4 lcd

I have a 16x4 lcd. First two lines displays strings correct, but in 3rd and 4th first characters are shifted for five positions. I faced this problem when i used to set LCD RAM address for these lines in RPi.GPIO they should be 0x90 for the 3rd line and 0xD0 for the 4th line. How can i fix it?

I2C ImportError

I'm not 100% sure if the issue is on my side or the Library. I get the following error on executing my python script:

$ python main.py 
Traceback (most recent call last):
  File "main.py", line 5, in <module>
    from RPLCD.i2c import CharLCD
ImportError: No module named 'RPLCD.i2c'

It's a fresh Raspbian installation with python-smbus package, activated i2c kernel module and your python library. My Python script is under the following repo: https://github.com/berkutta/rackbuddy

LCD 16x2: garbage or spontaneous settings change

Hi,
sometimes (e.g. after desk lamp, connected to adjacent outlet, is switched ON) LCD spontaneously changes settings. E.g. cursor becomes visible, as shown on the picture below (not that visible due to blinking). Sometimes there are corrupted symbols. If I keep my script running all over the night, typically at morning display has that problems.

Is this a (i) RasPi power source problem, (ii) long wiring of breaboard or (iii) software problem?
20160914_231427_rs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.