setBrightness()

Description
This function will dim the brightness of the OLED display.

Syntax


setBrightness(v)


Parameters
v – is a number between 0 and 4 (where 0 is dim and 4 is bright)

Returns
none

Example
Blog

// Light Read
if (Sensor.available()) {
int Light;
Light = Sensor.read();
stroke(255);
text(Light, 295, 230);
}

// Change screen brightness based on light
if (Sensor.available()) {
int Light;
Light = Sensor.read();
if (Light < 500) {
setBrightness(4);
} else {
if (Light > 500) {
setBrightness(0);
} }
}




Edit History