This commit is contained in:
Tom Ball
2016-06-14 17:21:02 -04:00
8 changed files with 134 additions and 16 deletions

View File

@ -29,7 +29,7 @@ the magnetic force is stronger, and dimmer when it is weaker.
```blocks
led.plot(2, 2)
basic.forever(() => {
let f = input.magneticForce("x")
let f = input.magneticForce(Dimension.X)
led.setBrightness(f / 2000)
})
```

View File

@ -1,6 +1,6 @@
# Brightness
Find how bright the [LED screen](/device/screen) is.
Find how bright the [LED screen](/device/screen) is _when it is turned on_.
```sig
led.brightness();
@ -8,11 +8,11 @@ led.brightness();
### Returns
* a [Number](/reference/types/number) that means how bright the screen is, from `0` (darkest) to `255` (brightest). For example, the number `127` means the screen is halfway bright.
* 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: highest brightness
This program makes the screen completely bright if it is not that way already:
This program makes the screen completely bright when it is turned on (if it is not that way already):
```blocks
if (led.brightness() < 255) {
@ -20,6 +20,20 @@ if (led.brightness() < 255) {
}
```
### 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
[set brightness](/reference/led/set-brightness), [fade in](/reference/led/fade-in), [fade out](/reference/led/fade-out)

View File

@ -1,6 +1,7 @@
# Set Brightness
Sets the brightness of the [LED screen](/device/screen).
Make the [LED screen](/device/screen) as bright as you say when it is
turned on.
```sig
led.setBrightness(121)
@ -8,17 +9,19 @@ led.setBrightness(121)
### Parameters
* value : [Number](/reference/types/number) - the brightness of the LED screen expressed as a number between 0 and 255
* 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
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):
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(127)
led.setBrightness(led.brightness() / 2)
```
### See also