This is the python library to control the Six-in-one LCD Adapter Kit Using 2004 or 1602 LCDs for Raspberry Pi.
sudo pip install SMlcd~$ 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
- 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
- Description
- Get the LCD Display busy flag
- Parameters
- none
- Returns
- 1 if the LCD is busy; 0 otherwise
- Description
- Send a command to the LCD Display
- Parameters
- value: command value, for example, Clear Display command value is 0x01
- Returns
- none
- 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
- Description
- Write one byte of data to the display
- Parameters
- value: The byte that will be sent to the LCD display
- Returns
- none
- Description
- Read one byte of data from the display
- Parameters
- none
- Returns
- One byte of data
- 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
- 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
- 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
- Description
- Set the single-color display backlight intensity
- Parameters
- val: intensity in precentage [0..100]
- Returns
- none
- 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
- Description
- Get one pushbutton current state
- Parameters
- button: button number [1..6]
- Returns
- button state: 1 - button is pressed; 0 - otherwise
- Description
- Returns the state of all 6 buttons as a bitmap
- Parameters
- none
- Returns
- all buttons state [0x00..0x3f]
- 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
- 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
- Description
- Get the encoder on change interrupt flag
- Parameters
- none
- Returns
- 1 - encoder value has been changed; 0 - if not
- Description
- Get the encoder accumulated value as a 16 bits signed integer
- Parameters
- none
- Returns
- encoder value (-32767..32767)
- Description
- Reset the encoder value
- Parameters
- none
- Returns
- none

