Hw chr display set brightness

From Sim Innovations Wiki
Jump to navigation Jump to search

Description

hw_chr_display_set_brightness(hw_chr_display_id, display, brightness)

hw_chr_display_set_brightness is used to set the brightness of a Hardware character display.

Info Only MAX7219 based character displays supports changing the brightness

Return value

This function won't return a value.

Arguments

# Argument Type Description
1 hw_chr_display_id Object This is the reference to the character display output. You can get this reference from the hw_chr_display_add function.
2 display Number The display where you wish to put the text. This only works with character display types that can be daisy chained. First display is 0.
3 brightness Number The brightness. Ranges from 0.0 (Off) to 1.0 (Full brightness).

Example (MAX7219)

-- Bind to the Arduino MEGA 2560 on channel A.
-- hw_id 1 = MAX7219 DIN (ARDUINO_MEGA2560_A_D4 in this example)
-- hw_id 2 = MAX7219 CLK (ARDUINO_MEGA2560_A_D5 in this example)
-- hw_id 3 = MAX7219 CS  (ARDUINO_MEGA2560_A_D6 in this example)
display_chr_id = hw_chr_display_add("MAX7219", 1, "ARDUINO_MEGA2560_A_D4", "ARDUINO_MEGA2560_A_D5", "ARDUINO_MEGA2560_A_D6")

-- Set brightness of the first display to 50%
hw_chr_display_set_brightness(display_chr_id, 0, 0.5)