2017-03-14 12:07:17 -07:00
|
|
|
# @extends
|
2016-06-14 17:20:45 -04:00
|
|
|
|
2017-03-14 12:07:17 -07:00
|
|
|
## #examples
|
2016-06-14 17:20:45 -04:00
|
|
|
|
|
|
|
### Example: adjusting screen brightness
|
|
|
|
|
2016-12-19 14:09:35 -08: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 17:20:45 -04:00
|
|
|
```blocks
|
2016-12-19 14:09:35 -08:00
|
|
|
input.onButtonPressed(Button.A, () => {
|
|
|
|
if(input.lightLevel()<100){
|
|
|
|
led.setBrightness(255);
|
|
|
|
}
|
|
|
|
})
|
2016-06-14 17:20:45 -04:00
|
|
|
```
|