pxt-calliope/docs/reference/led/brightness.md

27 lines
641 B
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# Brightness
2016-04-13 17:27:45 +02:00
Set the brightness of the [LED screen](/device/screen).
2016-03-26 00:47:20 +01:00
```sig
led.brightness();
```
### Returns
2016-04-13 17:27:45 +02:00
* [Number](/reference/types/number) - returns the LCD screen brightness as a number from 0 to 255. A return value of 255 means the screen brightness is at 100% and 127 is about 50% brightness.
2016-03-26 00:47:20 +01:00
### Example: maximum brightness
If the screen brightness is < 100%, the following code sets the brightness to 100% (255):
```blocks
if (led.brightness() < 255) {
led.setBrightness(255)
}
```
### See also
2016-04-13 17:27:45 +02:00
[set brightness](/reference/led/set-brightness), [fade in](/reference/led/fade-in), [fade out](/reference/led/fade-out)
2016-03-26 00:47:20 +01:00