Skip to main content

smlcd-rpi

sm_lcd

This is the python library to control the Six-in-one LCD Adapter Kit Using 2004 or 1602 LCDs for Raspberry Pi.

Install

sudo pip install SMlcd

Usage

~$ python
Python 3.10.7 (main, Nov  7 2022, 22:59:03) [GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sm_lcd
>>> lcd = sm_lcd.SMlcd()
>>> lcd.bl_single(50)
>>> lcd.display_init()
>>> lcd.text_write_at(1, 1, 'Hello world')
>>>

More usage example in the examples folder

Functions prototypes

smlcd-rpi

sm-lcd libray documentation

class sm_lcd.SMlcd(i2c = 1)

  • Description
    • Init the SMlcd object and check the card presence
  • Parameters
    • i2c : I2C port number, 1 - Raspberry default, 7 - rock pi 4, etc.
  • Returns
    • card object

busy()

  • Description
    • Get the LCD Display busy flag
  • Parameters
    • none
  • Returns
    • 1 if the LCD is busy; 0 otherwise

cmd(value)

  • Description
    • Send a command to the LCD Display
  • Parameters
    • value: command value, for example, Clear Display command value is 0x01
  • Returns
    • none

display_init()

  • Description
    • Default initialization for two or more lines display, not show cursor, no blinking cursor, no shifting. For custom initialization use cmd() function.
  • Parameters
    • none
  • Returns
    • none

data_write(value)

  • Description
    • Write one byte of data to the display
  • Parameters
    • value: The byte that will be sent to the LCD display
  • Returns
    • none

data_read()

  • Description
    • Read one byte of data from the display
  • Parameters
    • none
  • Returns
    • One byte of data

cursor_set(line, column)

  • Description
    • Set cursor position, this function works for multiline display, with a maximum of 4 lines and 20 columns
  • Parameters
    • line: line number [1..4]
    • column: column number [1..20]
  • Returns
    • none

text_write(text)

  • Description
    • Write a text at the cursor's current position. The function does not check the text length
  • Parameters
    • text: the string to be displayed
  • Returns
    • none

text_write_at(line, column, text):

  • Description
    • Write a text at the specified position. The function does not check the text length
  • Parameters
    • line display line number [1..4]
    • column display column number [1..20]
    • text the string to be displayed
  • Returns
    • none

bl_single(val)

  • Description
    • Set the single-color display backlight intensity
  • Parameters
    • val: intensity in precentage [0..100]
  • Returns
    • none

bl_rgb(red, green, blue)

  • Description
    • Set the RGB display backlight intensity by color
  • Parameters
    • red: red color intensity [0..100]
    • green: green color intensity [0..100]
    • blue: blue color intensity [0..100]
  • Returns
    • none

get_button(button)

  • Description
    • Get one pushbutton current state
  • Parameters
    • button: button number [1..6]
  • Returns
    • button state: 1 - button is pressed; 0 - otherwise

get_all_buttons()

  • Description
    • Returns the state of all 6 buttons as a bitmap
  • Parameters
    • none
  • Returns
    • all buttons state [0x00..0x3f]

get_button_int(button)

  • Description
    • Return 1 if a button has been pushed since the last call of this function. This function tells you if a button has generated an interrupt.
  • Parameters
    • button: button number [1..6]
  • Returns
    • 1 - the button has been pushed since last read; 0 - if not

get_all_buttons_int()

  • Description
    • Returns the interrupt flag for all buttons and the rotary encoder as a bitmap, buttons bits 0..5, encoder change interrupt bot 7.
  • Parameters
    • none
  • Returns
    • Interrupt flags

get_encoder_int()

  • Description
    • Get the encoder on change interrupt flag
  • Parameters
    • none
  • Returns
    • 1 - encoder value has been changed; 0 - if not

get_encoder_val()

  • Description
    • Get the encoder accumulated value as a 16 bits signed integer
  • Parameters
    • none
  • Returns
    • encoder value (-32767..32767)

reset_encoder()

  • Description
    • Reset the encoder value
  • Parameters
    • none
  • Returns
    • none

Metadata

Release files for smlcd 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smlcd 1.0.1
File Size Uploaded
smlcd-1.0.1.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for smlcd 1.0.1
File Interpreter ABI Platform
smlcd-1.0.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 10.5 kB

Release files / smlcd-1.0.1.tar.gz

Download URL smlcd-1.0.1.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
15c672cd97680aea3ad69b8631812dcc97bbab9a2349011802a40c9a5b58ee9c
BLAKE2b-256 checksum
How to use checksums
c9c596534f06c4e9102870e0d5ccd8f71eb4930eaeeba31dd8b9f1b7e5f1e04a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.2

Release files / smlcd-1.0.1-py2.py3-none-any.whl

Download URL smlcd-1.0.1-py2.py3-none-any.whl
Size 5.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
2863fb44dfb6858c9242e20759e8c181afba0fdb1145aec406f7e7149df628bf
BLAKE2b-256 checksum
How to use checksums
2f0cbd6518e9e24efec1514dcbe8ce70edac9b889878d61ed1e3d371de282e31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.2

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page