Giter VIP home page Giter VIP logo

adafruit_python_charlcd's Introduction

DEPRECATED LIBRARY. Adafruit Python CharLCD

This library has been deprecated! We are leaving this up for historical and research purposes but archiving the repository.

We are now only supporting the use of our CircuitPython libraries for use with Python.

Check out this guide for info on using character LCDs with the CircuitPython library: https://learn.adafruit.com/character-lcds/python-circuitpython

Adafruit_Python_CharLCD

Python library for accessing Adafruit character LCDs from a Raspberry Pi or BeagleBone Black.

Designed specifically to work with the Adafruit character LCDs ----> https://learn.adafruit.com/character-lcds/overview

For all platforms (Raspberry Pi and Beaglebone Black) make sure you have the following dependencies:

sudo apt-get update
sudo apt-get install build-essential python-dev python-smbus python-pip

For a Raspberry Pi make sure you have the RPi.GPIO library by executing:

sudo pip install RPi.GPIO

For a BeagleBone Black make sure you have the Adafruit_BBIO library by executing:

sudo pip install Adafruit_BBIO

Install the library by downloading with the download link on the right, unzipping the archive, navigating inside the library's directory and executing:

sudo python setup.py install

See example of usage in the examples folder.

Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

Written by Tony DiCola for Adafruit Industries.

MIT license, all text above must be included in any redistribution

adafruit_python_charlcd's People

Contributors

djkotowski avatar kattni avatar ladyada avatar lamenezes avatar tdicola avatar yoosi avatar

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  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

adafruit_python_charlcd's Issues

TypeError: argument 1 must be string, not int

Hi,

here is my problem:
Raspberry Pi with Raspbian operating system

get the following error
lcd = LCD.Adafruit_CharLCD(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7, lcd_columns, lcd_rows, lcd_backlight)
File "build/bdist.linux-armv7l/egg/Adafruit_CharLCD/Adafruit_CharLCD.py", line 143, in init
File "build/bdist.linux-armv7l/egg/Adafruit_GPIO/GPIO.py", line 278, in setup
TypeError: argument 1 must be string, not int

i've defined the variables:
#LCD variables
lcd_rs= 18
lcd_en= 23
lcd_d4= 12
lcd_d5= 16
lcd_d6= 20
lcd_d7= 21
lcd_backlight= 4
lcd_columns= 16
lcd_rows= 2

and included the library
import Adafruit_CharLCD as LCD

Error installing

Thank you for opening an issue on an Adafruit Python library repository. To
improve the speed of resolution please review the following guidelines and
common troubleshooting steps below before creating the issue:

  • Do not use GitHub issues for troubleshooting projects and issues. Instead use
    the forums at http://forums.adafruit.com to ask questions and troubleshoot why
    something isn't working as expected. In many cases the problem is a common issue
    that you will more quickly receive help from the forum community. GitHub issues
    are meant for known defects in the code. If you don't know if there is a defect
    in the code then start with troubleshooting on the forum first.

  • If following a tutorial or guide be sure you didn't miss a step. Carefully
    check all of the steps and commands to run have been followed. Consult the
    forum if you're unsure or have questions about steps in a guide/tutorial.

  • For Python/Raspberry Pi projects check these very common issues to ensure they don't apply:

    • If you are receiving an ImportError: No module named... error then a
      library the code depends on is not installed. Check the tutorial/guide or
      README to ensure you have installed the necessary libraries. Usually the
      missing library can be installed with the pip tool, but check the tutorial/guide
      for the exact command.

    • Be sure you are supplying adequate power to the board. Check the specs of
      your board and power in an external power supply. In many cases just
      plugging a board into your computer is not enough to power it and other
      peripherals.

    • Double check all soldering joints and connections. Flakey connections
      cause many mysterious problems. See the guide to excellent soldering for examples of good solder joints.

If you're sure this issue is a defect in the code and checked the steps above
please fill in the following fields to provide enough troubleshooting information.
You may delete the guideline and text above to just leave the following details:

  • Platform/operating system (i.e. Raspberry Pi with Raspbian operating system,
    Windows 32-bit, Windows 64-bit, Mac OSX 64-bit, etc.): INSERT PLATFORM/OPERATING
    SYSTEM HERE

  • Python version (run python -version or python3 -version): INSERT PYTHON
    VERSION HERE

  • Error message you are receiving, including any Python exception traces: INSERT
    ERROR MESAGE/EXCEPTION TRACES HERE
    *

  • List the steps to reproduce the problem below (if possible attach code or commands
    to run): LIST REPRO STEPS BELOW

error: Download error for https://github.com/adafruit/Adafruit_Python_GPIO/tarball/master#egg=Adafruit-GPIO-0.4.0: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661)

Disable cursor shift

Hello! Please, help me with a some question. I need to disable cursor moving when using function
lcd.message(). If I use lcd.set_cursor() and after this use lcd.message(), cursor changes his position.
How I can disable this effect?

Language Porting Info

Hey, I'm coming here from this product page http://www.adafruit.com/products/1115

Then to https://learn.adafruit.com/character-lcd-with-raspberry-pi-or-beaglebone-black/usage

And finally I'm here. So this uses Python. I'm going to add this to a ruby project, so I feel like I should use the ruby equivalent to this library to minimize the number of languages involved. It seems as though the ruby equivalent doesn't exist yet though. Correct me if I'm wrong, but to get the ruby equivelent I'd more or less just need to do a lot of copy and pasting (and do minor syntax editing) from this repo and also this Adafruit_Python_GPIO library https://github.com/adafruit/Adafruit_Python_GPIO and then call it a day, right? It seems odd that I would be the first to do that, so maybe I'm missing something?? If any repo watchers know of other libraries involved in the i2c chip used in the LCD that I should know about, I'd love to hear about it, and maybe the extra link/info should go into one of the repos so others know.

Subsequent uses of message only update the second line

When using the message-method repeatedly, only the second line of the LCD is updated.
An example script for reproducing the issue can be found here: https://gist.github.com/JanBe/8f8390484c13b7ab42a7

When executing the script, it would be expected to find the following output on the LCD:

New first line
New second line

However, the LCD reads:

First line
New second linef

As stated above, the first line is not updated. Additionally, the second line contains fragments from the sentence that was supposed to end up in the first line. The sentence was written to the end of the second line and then again overwritten by the updated second line:
Second line => Second lineNew f => New second linef

A workaround is to call clear() before subsequent uses of message, which however results in a small period of time between the two messages, in which the display is empty (and therefore looks like its flickering).

Instructions say to "sudo pip install RPi.GPIO" but the code seems to require Adafruit_GPIO.

Thank you for opening an issue on an Adafruit Python library repository. To
improve the speed of resolution please review the following guidelines and
common troubleshooting steps below before creating the issue:

  • Do not use GitHub issues for troubleshooting projects and issues. Instead use
    the forums at http://forums.adafruit.com to ask questions and troubleshoot why
    something isn't working as expected. In many cases the problem is a common issue
    that you will more quickly receive help from the forum community. GitHub issues
    are meant for known defects in the code. If you don't know if there is a defect
    in the code then start with troubleshooting on the forum first.

  • If following a tutorial or guide be sure you didn't miss a step. Carefully
    check all of the steps and commands to run have been followed. Consult the
    forum if you're unsure or have questions about steps in a guide/tutorial.

  • For Python/Raspberry Pi projects check these very common issues to ensure they don't apply:

    • If you are receiving an ImportError: No module named... error then a
      library the code depends on is not installed. Check the tutorial/guide or
      README to ensure you have installed the necessary libraries. Usually the
      missing library can be installed with the pip tool, but check the tutorial/guide
      for the exact command.

    • Be sure you are supplying adequate power to the board. Check the specs of
      your board and power in an external power supply. In many cases just
      plugging a board into your computer is not enough to power it and other
      peripherals.

    • Double check all soldering joints and connections. Flakey connections
      cause many mysterious problems. See the guide to excellent soldering for examples of good solder joints.

If you're sure this issue is a defect in the code and checked the steps above
please fill in the following fields to provide enough troubleshooting information.
You may delete the guideline and text above to just leave the following details:

  • Platform/operating system (i.e. Raspberry Pi with Raspbian operating system,
    Windows 32-bit, Windows 64-bit, Mac OSX 64-bit, etc.): INSERT PLATFORM/OPERATING
    SYSTEM HERE

  • Python version (run python -version or python3 -version): INSERT PYTHON
    VERSION HERE

  • Error message you are receiving, including any Python exception traces: INSERT
    ERROR MESAGE/EXCEPTION TRACES HERE
    *

  • List the steps to reproduce the problem below (if possible attach code or commands
    to run): LIST REPRO STEPS BELOW

Should be possible to run as non-root

Currently there seems to be a number of checks (and maybe other assumptions?) that require any program using this library to run as "root" user. This is extremely dangerous, especially if accepting user-input as it provides easy ways for an attacker to gain complete control over the operating system, possibly using it as an entry point to attack other devices and systems on the same network.

The library should instead allow you to make the calls as a non-root user and only generate an error message (or throw an exception which can be handled by the main application) if it encounters a problem. It is possible to configure permissions such that a non-root user has access to GPIO control and then the library would be able to run as that limited user safely confined to only the permissions the program requires.

In this example, you can see that my GPIO interface can be controlled by any user in the "gpio" group. This allows my various applications to run as unprivelaged users and the Linux kernel to enforce protections against potentially malicious activity (e.g. access user's personal files or change passwords) while still keeping full control of the GPIO interface to manipulate connected devices based on user-inputs.

$ ls -l /sys/class/gpio/
total 0
-rwxrwx--- 1 root gpio 4096 May 17 20:35 export
lrwxrwxrwx 1 root gpio 0 May 17 20:35 gpio12 -> ../../devices/platform/soc/3f200000.gpio/gpio/gpio12
lrwxrwxrwx 1 root gpio 0 May 15 21:09 gpio17 -> ../../devices/platform/soc/3f200000.gpio/gpio/gpio17
lrwxrwxrwx 1 root gpio 0 May 15 21:09 gpio18 -> ../../devices/platform/soc/3f200000.gpio/gpio/gpio18
lrwxrwxrwx 1 root gpio 0 May 15 21:09 gpio27 -> ../../devices/platform/soc/3f200000.gpio/gpio/gpio27
lrwxrwxrwx 1 root gpio 0 May 15 21:09 gpio4 -> ../../devices/platform/soc/3f200000.gpio/gpio/gpio4
lrwxrwxrwx 1 root gpio 0 May 17 20:35 gpio6 -> ../../devices/platform/soc/3f200000.gpio/gpio/gpio6
lrwxrwxrwx 1 root gpio 0 Dec 31 1969 gpiochip0 -> ../../devices/platform/soc/3f200000.gpio/gpio/gpiochip0
-rwxrwx--- 1 root gpio 4096 May 17 20:35 unexport

It may be if all the "is this root" checks are removed it would just work but I have not been successful in locating all the checks and understanding how the code works to fix this.
To check what groups a user is in you can use groups <username> and it will print the list of groups.
To add a user to the GPIO group, you can use the command sudo adduser <user> <group> where in raspbian would typically be "gpio" as shown in my directory listing.

Is 8.4 Jessie supported?

BB Green running Debian 8.4 Jessie
Python 3.4

I have a simple test program running that displays text on an RGB screen
it works fine on the same hardware running Debian 7.8 Wheezy

But after upgrading to Jessie, I cannot get any text on the screen and there are no errors in non PWM mode.
In PWM mode I do get an error in Adafruit GPIO "must start the PWM channel first"

Is this library supposed to work in Jessie which has some changes in Capemgr etc?

Bill

No module named Adafruit_CharLCD

Tried an example code to display on a 16x2 LCD with a BBB butt got the following error;
root@beaglebone:/Project/PythonEyeDetection# nano lcd_display.py
root@beaglebone:
/Project/PythonEyeDetection# nano lcd_display.py
root@beaglebone:~/Project/PythonEyeDetection# python lcd_display.py
Traceback (most recent call last):
File "lcd_display.py", line 5, in
import Adafruit_CharLCD as LCD
ImportError: No module named Adafruit_CharLCD

I then triedfollowing instructions to install it by pip but got the following result. It looks like BBB comes with preinstall Adafruit library but the older version which when i try to use pip it does not upgrade.

root@beaglebone:~/Project/PythonEyeDetection# pip install Adafruit_BBIO
Requirement already satisfied (use --upgrade to upgrade): Adafruit-BBIO in /usr/local/lib/python2.7/dist-packages
Cleaning up...

Wwhen i try to upgrade i get the following result but without it working;
root@beaglebone:/usr/local/lib/python2.7/dist-packages# pip install Adafruit_BBIO --upgrade
Requirement already up-to-date: Adafruit-BBIO in /usr/local/lib/python2.7/dist-packages
Cleaning up...

No events detection for buttons on RPi

Just bought this product: http://www.adafruit.com/product/1110
It works like a charm but something is bugging me..
Right now it seems that the only possible way to detect button presses is by using is_pressed() on a busy waiting loop. Needless to say this is highly inefficient.
This request involves 2 projects (this one and Adafruit_GPIO). I've looked into both the code of this project and of Adafruit_GPIO, and it seems that the use of GPIO.RPiGPIOAdapter in the MCP (instead of GPIO.BaseGPIO) would be more appropriate in the case of using a RPi, because it supports the events features not included in the current code.

I've tried to do this myself but I don't quite understand the code in Adafruit_GPIO/MCP230xx.py since it's my first time playing around the gpio. I'm not quite sure if it's a valid request or if I should submit it on the Adafruit_GPIO project instead.

Delay seems to not be enough time for the clear operation

It seems that the delay for the clear functionality across CharLCDs is a tad bit too quick for at least one such device. Clearing the screen and immediately sending a message gives garbage on the screen (using an adafruit bought 16x2 character LCD display). This was resolved by increasing the delay time between the clear() and message() calls.

Please also reference this stack overflow thread and notice the comments. This seems like a delay-time issue even after user switched to this repo's version of the lib.

  • Platform/operating system (i.e. Raspberry Pi with Raspbian operating system,
    Windows 32-bit, Windows 64-bit, Mac OSX 64-bit, etc.): Raspberry Pi with Raspbian operating system

  • Python version (run python -version or python3 -version): python 2.7

  • Error message you are receiving, including any Python exception traces: N/A

  • List the steps to reproduce the problem below (if possible attach code or commands
    to run): LIST REPRO STEPS BELOW

  1. Initialize Adafruit_CharLCD
  2. Perform display clear
  3. Immediately after send a message using the message class function (e.g. lcd.message("string"))

Backlight Off if pressing up or down buttons

In the example "sudo python char_lcd_plate.py". Almost everything seems like it works ok, but during the button press example, if I press the up or down button the backlight turns off. It correctly shows the button I pressed but without the backlight. Then if I press any other button, then backlight then turns back on. Any suggestions as to what may be causing this ?

No Module Named Adafruit_CharLCD

Hey, I was trying to play around with LCD and installed this library. But when i write the command below in thonny and run it, it gives me this error;
ImportError: No module named 'Adafruit_CharLCD'

import time
import Adafruit_CharLCD as LCD

lcd_rs = 37
lcd_en = 35
lcd_d4 = 33
lcd_d5 = 31
lcd_d6 = 29
lcd_d7 = 23
lcd_backlight = 4

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_backlight)

lcd.message('Hello\nworld!')
time.sleep(5.0)
lcd.clear()
text = raw_input("Type Something to be displayed: ")
lcd.message(text)

time.sleep(5.0)
lcd.clear()
lcd.message('Goodbye\nWorld!')

time.sleep(5.0)
lcd.clear()

i'm using python3
With Correct indentation.
Any help is greatly appreciated! Thank You

Arch Linux

Add 'arch-armv61' as a Raspberry Pi platform in Platform.py.

Problems with LCD 16x2 and Adafruit CHarLCD library on RAspberry Pi

Thank you for opening an issue on an Adafruit Python library repository. To
improve the speed of resolution please review the following guidelines and
common troubleshooting steps below before creating the issue:

  • Do not use GitHub issues for troubleshooting projects and issues. Instead use
    the forums at http://forums.adafruit.com to ask questions and troubleshoot why
    something isn't working as expected. In many cases the problem is a common issue
    that you will more quickly receive help from the forum community. GitHub issues
    are meant for known defects in the code. If you don't know if there is a defect
    in the code then start with troubleshooting on the forum first.
  • If following a tutorial or guide be sure you didn't miss a step. Carefully
    check all of the steps and commands to run have been followed. Consult the
    forum if you're unsure or have questions about steps in a guide/tutorial.
  • For Python/Raspberry Pi projects check these very common issues to ensure they don't apply:
    • If you are receiving an ImportError: No module named... error then a
      library the code depends on is not installed. Check the tutorial/guide or
      README to ensure you have installed the necessary libraries. Usually the
      missing library can be installed with the pip tool, but check the tutorial/guide
      for the exact command.
    • Be sure you are supplying adequate power to the board. Check the specs of
      your board and power in an external power supply. In many cases just
      plugging a board into your computer is not enough to power it and other
      peripherals.
    • Double check all soldering joints and connections. Flakey connections
      cause many mysterious problems. See the guide to excellent soldering for examples of good solder joints.

If you're sure this issue is a defect in the code and checked the steps above
please fill in the following fields to provide enough troubleshooting information.
You may delete the guideline and text above to just leave the following details:

  • Platform/operating system (i.e. Raspberry Pi with Raspbian operating system,
    Windows 32-bit, Windows 64-bit, Mac OSX 64-bit, etc.): INSERT PLATFORM/OPERATING
    SYSTEM HERE
  • Python version (run python -version or python3 -version): INSERT PYTHON
    VERSION HERE
  • Error message you are receiving, including any Python exception traces: INSERT
    ERROR MESAGE/EXCEPTION TRACES HERE
    *
  • List the steps to reproduce the problem below (if possible attach code or commands
    to run): LIST REPRO STEPS BELOW

IOError: [Errno 5] Input/output error

I'm using Raspberry pi B+ model and Adafruit 16x2 character LCD plus keypad for raspberry pi
I made all the steps in the guidelines when I write the final step sudo python cahr_lcd_plat.py the terminal gives me this error:

Traceback (most recent call last): File "char_lcd_plate.py", line 9, in lcd = LCD.Adafruit_charLCDPlate() File "build/bdist.linux-armv6l/egg/Adafruit_CharLCD/Adafruit_CharLCD.py", line 432, in init File "build/bdist.linux-armv6l/egg/Adafruit_GPIO/MCP230xx.py", line 150, in init File "build/bdist.linux-armv6l/egg/Adafruit_GPIO/MCP230xx.py", line 46, in init File "build/bdist.linux-armv6l/egg/Adafruit_GPIO/MCP230xx.py", line 130, in write_iodir File "build/bdist.linux-armv6l/egg/Adafruit_GPIO/I2C.py", line 95, in writelist IOError: [Errno 5] Input/output error

anyone can help me please? I2C operates on smbus[1]

Thanks

Turning off backlight/display not working for another lcd

I really like the library you made here but these 2 functions aren't working and I'm wondering if there is a way to fix this. My LCD screen is 16x2 but with only 16 pin (LED backlight).
I followed the tutorial on https://learn.adafruit.com/character-lcd-with-raspberry-pi-or-beaglebone-black/wiring except for pin 16 connected to the 5V.

  • I'm using RPI 2 B with Jessie
  • Python 2.7.9
  • No message/traces, I'm using char_lcd.py and nothing happen when I call lcd.set_backlight(0). Same result if I replace it with lcd.enable_display(0)

I hope you can help me!
Art'

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.