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

32 lines
735 B
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# Set Brightness
2016-04-13 17:27:45 +02:00
Sets the brightness of the [LED screen](/device/screen).
2016-03-26 00:47:20 +01:00
```sig
led.setBrightness(121)
```
### Parameters
2016-04-13 17:27:45 +02:00
* value : [Number](/reference/types/number) - the brightness of the LED screen expressed as a number between 0 and 255
2016-03-26 00:47:20 +01:00
### Example: change brightness
The following example sets the screen brightness to 100% (255), turns on LED `2, 2`, waits for a second and then sets the screen brightness to 50% (127):
```blocks
led.setBrightness(255)
led.plot(2, 2)
basic.pause(1000)
led.setBrightness(127)
```
### Lessons
2016-04-13 17:27:45 +02:00
[night light](/lessons/night-light)
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)
2016-03-26 00:47:20 +01:00