backlight
The backlight library is used to change the backlight brightness of the entire screen including all objects on it.
For it you need to import the backlight library:
import backlight
lightsensor
This function is used to get the current lightsensor value from the LDR
backlight.lightsensor() # Returns the current value from the LDR.
This returns a value from anywhere between 0 (darkness) to 65535 (bright light)
set
This is used to manually set the backlight brightness.
# These values affect all graphical objects.
backlight.set(brightness) # Used to set the brightness.
Input Parameters:
brightness[int] = The brightness value, this value ranges from 0 to 10000
When run, this function will automatically disable auto-brightness and set your brightness level.
Note
The brightness scale is not linear. It has the formula: screen_brightness = (user_brightness * 20)**2.
When setting your brightness changing your value by increments of 1000 at a time is a good plan.
set_auto
backlight.set_auto(low, high, minimum) # Used to set a range for the automatic brightness settings to work. The automatic brightness uses the LDR on the right side on the bottom bar of all VBOX Touch products.
Input Parameters:
low[int] = The light sensor between 0 to 65535 at which the backlight is at its lowest brightness
high[int] = The light sensor between 0 to 65535 at which the backlight is at the highest brightness
minimum[int] = The backlight value of the lowest brightness between 0 to 10000.
This by default is (0, 65535, 0)
Note:
screenshot_cb() from the screenshot library will not record the brightness change of the screen when using backlight.