pxt-calliope/docs/reference/led/set-brightness.md
2016-07-18 11:14:51 -07:00

33 lines
867 B
Markdown

# Set Brightness
Make the [LED screen](/device/screen) as bright as you say when it is
turned on.
```sig
led.setBrightness(121)
```
### Parameters
* ``value`` is a [number](/reference/types/number) that means how
bright the screen is when it is turned on, from `0` (darkest) to
`255` (brightest). For example, the number `127` means the screen is
halfway bright when it is turned on.
### Example: change brightness
This program makes the screen brightness 100% (`255`). Then it turns on
the center LED (`2, 2`), waits for one second, and then sets the screen
brightness to 50% (`128`):
```blocks
led.setBrightness(255)
led.plot(2, 2)
basic.pause(1000)
led.setBrightness(led.brightness() / 2)
```
### See also
[brightness](/reference/led/brightness), [fade in](/reference/led/fade-in), [fade out](/reference/led/fade-out), [LED screen](/device/screen)