2016-03-26 00:47:20 +01:00
|
|
|
# Set Brightness
|
|
|
|
|
2016-06-14 21:51:21 +02:00
|
|
|
Make the [LED screen](/device/screen) as bright as you say when it is
|
|
|
|
turned on.
|
2016-03-26 00:47:20 +01:00
|
|
|
|
|
|
|
```sig
|
|
|
|
led.setBrightness(121)
|
|
|
|
```
|
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
2017-03-16 15:57:41 +01:00
|
|
|
* ``value`` is a [number](/types/number) that means how
|
2016-07-18 20:14:51 +02:00
|
|
|
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.
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2017-03-24 15:14:37 +01:00
|
|
|
### ~ hint
|
|
|
|
|
|
|
|
The brightness is not supported in the simulator. You will need to try it on the @boardname@ itself!
|
|
|
|
|
|
|
|
###
|
|
|
|
|
2016-03-26 00:47:20 +01:00
|
|
|
### Example: change brightness
|
|
|
|
|
2016-07-18 20:14:51 +02:00
|
|
|
This program makes the screen brightness 100% (`255`). Then it turns on
|
2016-06-14 21:51:21 +02:00
|
|
|
the center LED (`2, 2`), waits for one second, and then sets the screen
|
2016-07-18 20:14:51 +02:00
|
|
|
brightness to 50% (`128`):
|
2016-03-26 00:47:20 +01:00
|
|
|
|
|
|
|
```blocks
|
|
|
|
led.setBrightness(255)
|
|
|
|
led.plot(2, 2)
|
|
|
|
basic.pause(1000)
|
2016-06-14 21:51:21 +02:00
|
|
|
led.setBrightness(led.brightness() / 2)
|
2016-03-26 00:47:20 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
### See also
|
|
|
|
|
2016-04-13 17:27:45 +02:00
|
|
|
[brightness](/reference/led/brightness), [fade in](/reference/led/fade-in), [fade out](/reference/led/fade-out), [LED screen](/device/screen)
|