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.

TM1637 Class

Module: tm1637

TM1637 is a display controller for LED-based 7-segment displays. It can be used to address and write data to multiple display digits. This driver is based on the Grove version of the TM1637 display that uses 4 digits, thus making it ideal for clock displays, timers, counters, or even score displays in a two-player arcade game.
tm1637.jpeg

Methods

TM1637

(
  • clk_pin
  • dio_pin
  • bright
)
Number

TM1637 constructor

Parameters:

  • clk_pin Number

    Clock pin the sensor is connected to

  • dio_pin Number

    Data pin the sensor is connected to

  • bright Number

    Initial brightness, from 0 (dark) to 7 (bright) (default is 3)

Returns:

Number:

write

(
  • digits
)
Mraa_result_t

Writes digits to the display in a 7-segment encoding

Parameters:

  • digits Uint8_t *

    Array of digits to send to the display

Returns:

Mraa_result_t:

0 if successful, error code otherwise

write

(
  • d
  • arguments
)
Mraa_result_t

Writes digits to the display in a 7-segment encoding

Parameters:

  • d Number

    List of multiple arguments to send to the display

  • arguments ...

    undefined

Returns:

Mraa_result_t:

0 if successful, error code otherwise

writeAt

(
  • index
  • symbol
)
Mraa_result_t

Writes a symbol (digit or letter) to the display in a specified index

Parameters:

  • index Number

    0-based index of the digit to change from the left

  • symbol String

    Digit or letter to display

Returns:

Mraa_result_t:

0 if successful, error code otherwise

write

(
  • digits
)
Mraa_result_t

Writes all the digits or letters to the display as a string

Parameters:

  • digits String

    String of symbols to display

Returns:

Mraa_result_t:

0 if successful, error code otherwise

setColon

(
  • value
)

Toggles the colon between digits on the display

Parameters:

  • value Boolean

    True to turn the colon on, false to turn it off

setBrightness

(
  • value
)

Controls the brightness of the display

Parameters:

  • value Number

    Brightness, from 0 (darkest) to 7 (brightest)