2017-03-14 20:07:17 +01:00
|
|
|
# @extends
|
2016-06-14 23:20:45 +02:00
|
|
|
|
2017-03-14 20:07:17 +01:00
|
|
|
## #examples
|
2016-06-14 23:20:45 +02:00
|
|
|
|
2017-09-07 22:42:08 +02:00
|
|
|
## Example: adjusting screen brightness
|
2016-06-14 23:20:45 +02:00
|
|
|
|
2016-12-19 23:09:35 +01:00
|
|
|
If the [light level](/reference/input/light-level) is `< 100`, this code sets the brightness to `255` when the button A is pressed:
|
|
|
|
|
2016-06-14 23:20:45 +02:00
|
|
|
```blocks
|
2016-12-19 23:09:35 +01:00
|
|
|
input.onButtonPressed(Button.A, () => {
|
|
|
|
if(input.lightLevel()<100){
|
|
|
|
led.setBrightness(255);
|
|
|
|
}
|
|
|
|
})
|
2016-06-14 23:20:45 +02:00
|
|
|
```
|