Giter VIP home page Giter VIP logo

adafruit_circuitpython_charlcd's Introduction

Introduction

Documentation Status

Build Status

This library is compatible with standard Character LCDs such as: * Adafruit Standard LCD 16x2 * Adafruit RGB backlight negative LCD 16x2 * Adafruit RGB backlight negative LCD 20x4

Installing from PyPI

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:

pip3 install adafruit-circuitpython-charlcd

To install system-wide (this may be required in some cases):

sudo pip3 install adafruit-circuitpython-charlcd

To install in a virtual environment in your current project:

mkdir project-name && cd project-name
python3 -m venv .env
source .env/bin/activate
pip3 install adafruit-circuitpython-charlcd

Dependencies

This driver depends on:

I2C & SPI displays also depend on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.

Usage Example

The Character_LCD class interfaces a predefined Character LCD display with CircuitPython.

import board
import digitalio
import adafruit_character_lcd.character_lcd as character_lcd

You must define the data pins (RS, EN, D4, D5, D6, D7) in your code before using the Character_LCD class. If you want to have on/off backlight functionality, you can also define your backlight as lcd_backlight. Otherwise, the backlight will always remain on. The following is an example setup.

lcd_rs = digitalio.DigitalInOut(board.D7)
lcd_en = digitalio.DigitalInOut(board.D8)
lcd_d7 = digitalio.DigitalInOut(board.D12)
lcd_d6 = digitalio.DigitalInOut(board.D11)
lcd_d5 = digitalio.DigitalInOut(board.D10)
lcd_d4 = digitalio.DigitalInOut(board.D9)
lcd_backlight = digitalio.DigitalInOut(board.D13)

You must also define the size of the CharLCD by specifying its lcd_columns and lcd_rows:

lcd_columns = 16
lcd_rows = 2

After you have set up your LCD, we can make the device by calling it

lcd = character_lcd.Character_LCD_Mono(lcd_rs, lcd_en, lcd_d4, lcd_d5, lcd_d6, lcd_d7, lcd_columns, lcd_rows, lcd_backlight)

To verify that your pins are correct, print a hello message to the CharLCD:

lcd.message = "Hello\nCircuitPython"

Custom character example with create_char() is provided within /examples/

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Building locally

To build this library locally you'll need to install the circuitpython-build-tools package.

python3 -m venv .env
source .env/bin/activate
pip install circuitpython-build-tools

Once installed, make sure you are in the virtual environment:

source .env/bin/activate

Then run the build:

circuitpython-build-bundles --filename_prefix adafruit-circuitpython-charlcd --library_location .

Sphinx documentation

Sphinx is used to build the documentation based on rST files and comments in the code. First, install dependencies (feel free to reuse the virtual environment from above):

python3 -m venv .env
source .env/bin/activate
pip install Sphinx sphinx-rtd-theme

Now, once you have the virtual environment activated:

cd docs
sphinx-build -E -W -b html . _build/html

This will output the documentation to docs/_build/html. Open the index.html in your browser to view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to locally verify it will pass.

adafruit_circuitpython_charlcd's People

Contributors

asherlie avatar brennen avatar brentru avatar caternuson avatar kattni avatar khavik avatar ladyada avatar makermelissa avatar mrmcwethy avatar ncguk avatar profbrady avatar sommersoft avatar tdicola avatar tim-jackins avatar

Watchers

 avatar

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.