UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

Lcm1602 Class

Module: lcm1602

This supports all sizes of HD44780 displays, from 16x2 to 4x20. The controller has no idea of the actual display hardware, so it lets you write farther than you can see. These displays with such controllers are available from various manufacturers with different I2C addresses. Adafruit* TC1602A-01T seems to be a well-documented example. The driver also supports parallel GPIO connections directly to the HD44780 in case you are not using an I2C expander/backpack.
lcm1602.jpeg Example for LCM1602 displays that use the I2C bus Code sample for GPIO based LCM1602 displays

Methods

Lcm1602

(
  • bus
  • address
  • isExpander
  • numColumns
  • numRows
)
Number

Lcm1602 constructor; calls libmraa initialisation functions

Parameters:

  • bus Number

    I2C bus to use. Default 0 (autodetect).

  • address Number

    Slave address the LCD is registered on. Default 0x27

  • isExpander Boolean

    True if we are dealing with an I2C expander, false otherwise. Default is true.

  • numColumns Number

    Number of columns the display has. Default 16.

  • numRows Number

    Number of rows the display has. Default 2.

Returns:

Number:

Lcm1602

(
  • rs
  • enable
  • d0
  • d1
  • d2
  • d3
  • numColumns
  • numRows
)
Number

Lcm1602 alternate constructor, used for GPIO based HD44780 controllers supporting RS, Enable, and 4 data pins in 4-bit mode.

Parameters:

  • rs Number

    Register select pin

  • enable Number

    Enable pin

  • d0 Number

    Data 0 pin

  • d1 Number

    Data 1 pin

  • d2 Number

    Data 2 pin

  • d3 Number

    Data 3 pin

  • numColumns Number

    Number of columns the display has. Default 16.

  • numRows Number

    Number of rows the display has. Default 2.

Returns:

Number:

write

(
  • msg
)
Upm_result_t

Writes a string to the LCD

Parameters:

  • msg String

    std::string to write to the display; note: only ASCII characters are supported

Returns:

Upm_result_t:

Result of the operation

setCursor

(
  • row
  • column
)
Upm_result_t

Sets the cursor to specified coordinates

Parameters:

  • row Number

    Row to set the cursor to

  • column Number

    Column to set the cursor to

Returns:

Upm_result_t:

Result of the operation

clear

() Upm_result_t

Clears the display of all characters

Returns:

Upm_result_t:

Result of the operation

home

() Upm_result_t

Returns to the original coordinates (0,0)

Returns:

Upm_result_t:

Result of the operation

createChar

(
  • charSlot
  • charData
)
Upm_result_t

Create a custom character

Parameters:

  • charSlot Number

    the character slot to write, only 8 are available

  • charData Std::vector uint8_t

    A vector containing 8 bytes making up the character

Returns:

Upm_result_t:

Result of operation

displayOn

() Upm_result_t

Turn the display on

Returns:

Upm_result_t:

Result of operation

displayOff

() Upm_result_t

Turn the display off

Returns:

Upm_result_t:

Result of operation

cursorOn

() Upm_result_t

Turn the cursor on

Returns:

Upm_result_t:

Result of operation

cursorOff

() Upm_result_t

Turn the cursor off

Returns:

Upm_result_t:

Result of operation

cursorBlinkOn

() Upm_result_t

Turn cursor blink on

Returns:

Upm_result_t:

Result of operation

cursorBlinkOff

() Upm_result_t

Turn cursor blink off

Returns:

Upm_result_t:

Result of operation

backlightOn

() Upm_result_t

Turn backlight on

Returns:

Upm_result_t:

Result of operation

backlightOff

() Upm_result_t

Turn backlight off

Returns:

Upm_result_t:

Result of operation

scrollDisplayLeft

() Upm_result_t

Scroll the display left, without changing the character RAM

Returns:

Upm_result_t:

Result of operation

scrollDisplayRight

() Upm_result_t

Scroll the display right, without changing the character RAM

Returns:

Upm_result_t:

Result of operation

entryLeftToRight

() Upm_result_t

set the entry mode so that characters are added left to right

Returns:

Upm_result_t:

Result of operation

entryRightToLeft

() Upm_result_t

set the entry mode so that characters are added right to left

Returns:

Upm_result_t:

Result of operation

autoscrollOn

() Upm_result_t

Right justify text entered from the cursor

Returns:

Upm_result_t:

Result of operation

autoscrollOff

() Upm_result_t

Left justify text entered from the cursor

Returns:

Upm_result_t:

Result of operation