@ -6,11 +6,11 @@ Find how bright the [LED screen](/device/screen) is _when it is turned on_.
|
||||
led.brightness();
|
||||
```
|
||||
|
||||
### Returns
|
||||
## Returns
|
||||
|
||||
* a [number](/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
|
||||
## Example: highest brightness
|
||||
|
||||
This program makes the screen completely bright when it is turned on (if it is not that way already):
|
||||
|
||||
@ -21,7 +21,7 @@ if (led.brightness() < 255) {
|
||||
```
|
||||
|
||||
|
||||
### Example: change brightness
|
||||
## 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
|
||||
@ -34,7 +34,7 @@ basic.pause(1000)
|
||||
led.setBrightness(led.brightness() / 2)
|
||||
```
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[set brightness](/reference/led/set-brightness), [fade in](/reference/led/fade-in), [fade out](/reference/led/fade-out)
|
||||
|
||||
|
@ -6,11 +6,11 @@ Turns the LED screen on and off
|
||||
led.enable(false);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* ``on`` is a [boolean](/types/boolean) that defines the on/off state of the screen
|
||||
|
||||
### Example: Turning off the screen
|
||||
## Example: Turning off the screen
|
||||
|
||||
This program turns off the screen when pressing button ``B``
|
||||
|
||||
@ -20,7 +20,7 @@ input.onButtonPressed(Button.B, () => {
|
||||
});
|
||||
```
|
||||
|
||||
### Pins: P3, P4, P6, P7, P9, P10
|
||||
## Pins: P3, P4, P6, P7, P9, P10
|
||||
|
||||
These pins are coupled to the LED matrix display, and also it’s associated ambient light sensing mode.
|
||||
To disable the display driver feature (which will automatically disable the light sensing feature) call the DAL function ``led.enable(false)``.
|
||||
@ -28,6 +28,6 @@ To turn the display driver back on again later, call ``led.enable(true)``.
|
||||
|
||||
More information at http://tech.microbit.org/hardware/edgeconnector_ds/ .
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[unplot](/reference/led/unplot), [point](/reference/led/point), [LED screen](/device/screen)
|
||||
|
@ -6,11 +6,11 @@ Gradually increase the [LED screen](/device/screen) brightness until the LED lig
|
||||
led.fadeIn(700);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* ms - [Number](/types/number); the speed by which the screen brightness is increased, expressed in milliseconds (1,000 milliseconds = 1 second). The smaller the number the faster the screen brightness increased.
|
||||
|
||||
### Example: fading dot
|
||||
## Example: fading dot
|
||||
|
||||
The following code turns on centre LED and then gradually increases and decreases the screen brightness (the centre LED pulses 5 times):
|
||||
|
||||
@ -24,7 +24,7 @@ for (let i = 0; i < 5; i++) {
|
||||
}
|
||||
```
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[brightness](/reference/led/brightness), [fade out](/reference/led/fade-out), [set brightness](/reference/led/set-brightness)
|
||||
|
||||
|
@ -6,11 +6,11 @@ Gradually decrease the [LED screen](/device/screen) brightness until the LED lig
|
||||
led.fadeOut(700);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* ms - [Number](/types/number); the speed that the screen brightness is decreased, expressed in milliseconds (1,000 milliseconds = 1 second). The smaller the number the faster the screen brightness decreased.
|
||||
|
||||
### Example: fade away letter A
|
||||
## Example: fade away letter A
|
||||
|
||||
The following example sets the screen brightness to the maximum brightness, displays the letter A, and then gradually fades the letter away:
|
||||
|
||||
@ -20,7 +20,7 @@ basic.showString("A", 1000)
|
||||
led.fadeOut(1000)
|
||||
```
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[brightness](/reference/led/brightness), [fade in](/reference/led/fade-in), [set brightness](/reference/led/set-brightness)
|
||||
|
||||
|
@ -6,7 +6,7 @@ Turn on all the 25 LEDs on the [LED screen](/device/screen).
|
||||
led.plotAll()
|
||||
```
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[LED screen](/device/screen), [clear screen](/reference/basic/clear-screen)
|
||||
|
||||
|
@ -7,7 +7,7 @@ A bar graph is a kind of chart that shows numbers as lines with different length
|
||||
led.plotBarGraph(2, 20);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* ``value`` is a [number](/types/number) that means what you
|
||||
are measuring or trying to show. For example, if you are measuring
|
||||
@ -17,7 +17,7 @@ led.plotBarGraph(2, 20);
|
||||
possible number that the ``value`` parameter can be. This number is
|
||||
also the tallest that the lines in the bar chart can be.
|
||||
|
||||
### Example: chart acceleration
|
||||
## Example: chart acceleration
|
||||
|
||||
This program shows a bar graph of the [acceleration](/reference/input/acceleration)
|
||||
in the `x` direction of the @boardname@.
|
||||
@ -33,7 +33,7 @@ basic.forever(() => {
|
||||
})
|
||||
```
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[brightness](/reference/led/brightness), [fade in](/reference/led/fade-in), [fade out](/reference/led/fade-out), [LED screen](/device/screen), [stop animation](/reference/led/stop-animation)
|
||||
|
||||
|
@ -12,7 +12,7 @@ Use [unplot](/reference/led/unplot) to turn **off** an LED.
|
||||
|
||||
## ~
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* ``x`` is a [number](/types/number) that means the
|
||||
horizontal spot on the LED screen (from left to right: 0, 1, 2, 3,
|
||||
@ -23,15 +23,15 @@ Use [unplot](/reference/led/unplot) to turn **off** an LED.
|
||||
If a parameter is [out of bounds](/reference/out-of-bounds) (a value
|
||||
other than 0 to 4), then this function will do nothing.
|
||||
|
||||
### ~hint
|
||||
## ~hint
|
||||
|
||||
The LED screen is a solid square of LEDs with five LEDs on each side.
|
||||
To learn more about how you number the LEDs with ``x`` and ``y``
|
||||
coordinates, see [LED screen](/device/screen).
|
||||
|
||||
### ~
|
||||
## ~
|
||||
|
||||
### Example: One LED
|
||||
## Example: One LED
|
||||
|
||||
This program turns on the bottom right LED.
|
||||
|
||||
@ -40,7 +40,7 @@ led.plot(4, 4)
|
||||
```
|
||||
|
||||
|
||||
### Example: Square
|
||||
## Example: Square
|
||||
|
||||
This program uses a [for loop](/blocks/loops/for)
|
||||
and the `plot` function
|
||||
@ -56,13 +56,13 @@ for (let i = 0; i < 5; i++) {
|
||||
}
|
||||
```
|
||||
|
||||
### ~hint
|
||||
## ~hint
|
||||
|
||||
Use the [point](/reference/led/point) function to find out if an LED is
|
||||
on or off.
|
||||
|
||||
### ~
|
||||
## ~
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[unplot](/reference/led/unplot), [point](/reference/led/point), [LED screen](/device/screen)
|
||||
|
@ -7,7 +7,7 @@ Find whether the LED you say on the
|
||||
led.point(0,0);
|
||||
```
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* ``x`` is a [number](/types/number) that means the
|
||||
horizontal spot on the LED screen (from left to right: 0, 1, 2, 3,
|
||||
@ -18,19 +18,19 @@ led.point(0,0);
|
||||
If a parameter is [out of bounds](/reference/out-of-bounds) (a value
|
||||
other than 0 to 4), this function will return `false`.
|
||||
|
||||
### Returns
|
||||
## Returns
|
||||
|
||||
* a [boolean](/blocks/logic/boolean). If it is `true`, that means the LED is on. If it is `false`, that means the LED is off.
|
||||
|
||||
### ~hint
|
||||
## ~hint
|
||||
|
||||
The LED screen is a solid square of LEDs with five LEDs on each side.
|
||||
To learn more about how you number the LEDs with ``x`` and ``y``
|
||||
coordinates, see [LED screen](/device/screen).
|
||||
|
||||
### ~
|
||||
## ~
|
||||
|
||||
### Example: Toggle off
|
||||
## Example: Toggle off
|
||||
|
||||
This program turns the center LED (2, 2) off if it is already on. (If
|
||||
it is already off, this program leaves it off.)
|
||||
@ -41,7 +41,7 @@ if (led.point(2, 2)) {
|
||||
}
|
||||
```
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[unplot](/reference/led/unplot), [plot](/reference/led/plot), [LED screen](/device/screen)
|
||||
|
||||
|
@ -6,15 +6,15 @@ Make an [Image](/reference/images/image) out of the current state of the [LED sc
|
||||
led.screenshot();
|
||||
```
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* none
|
||||
|
||||
### Returns
|
||||
## Returns
|
||||
|
||||
* an [Image](/reference/images/image) of what is currently visible on the [LED screen](/device/screen)
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[create image](/reference/images/create-image), [LED screen](/device/screen),
|
||||
|
||||
|
@ -7,20 +7,20 @@ turned on.
|
||||
led.setBrightness(121)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* ``value`` is a [number](/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.
|
||||
|
||||
### ~ hint
|
||||
## ~ hint
|
||||
|
||||
The brightness is not supported in the simulator. You will need to try it on the @boardname@ itself!
|
||||
|
||||
### ~
|
||||
## ~
|
||||
|
||||
### Example: change brightness
|
||||
## 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
|
||||
@ -33,6 +33,6 @@ basic.pause(1000)
|
||||
led.setBrightness(led.brightness() / 2)
|
||||
```
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[brightness](/reference/led/brightness), [fade in](/reference/led/fade-in), [fade out](/reference/led/fade-out), [LED screen](/device/screen)
|
||||
|
@ -7,7 +7,7 @@ play.
|
||||
led.stopAnimation()
|
||||
```
|
||||
|
||||
### Example
|
||||
## Example
|
||||
|
||||
This program sets up the ``stop animation`` part of the program,
|
||||
and then shows a string that you can stop with button ``B``.
|
||||
@ -19,14 +19,14 @@ input.onButtonPressed(Button.B, () => {
|
||||
basic.showString("STOP ME! STOP ME! PLEASE, WON'T SOMEBODY STOP ME?");
|
||||
```
|
||||
|
||||
### ~hint
|
||||
## ~hint
|
||||
|
||||
It's important to set up ``stop animation`` before showing the
|
||||
animation, so the ``stop animation`` part of the program will be ready
|
||||
to go.
|
||||
|
||||
### ~
|
||||
## ~
|
||||
|
||||
### See Also
|
||||
## See Also
|
||||
|
||||
[show animation](/reference/basic/show-animation)
|
||||
|
@ -6,11 +6,11 @@ Toggle all the 25 LEDs on the [LED screen](/device/screen) - if an LED is on bef
|
||||
led.toggleAll()
|
||||
```
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* none
|
||||
|
||||
### Example
|
||||
## Example
|
||||
|
||||
The following code will result in every LED being on except for the LED at coordinate (2,2)
|
||||
|
||||
@ -26,7 +26,7 @@ led.plot(2, 2)
|
||||
led.toggleAll()
|
||||
```
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[toggle](/reference/led/toggle), [LED screen](/device/screen), [clear screen](/reference/basic/clear-screen)
|
||||
|
||||
|
@ -6,18 +6,18 @@ Toggle a LED light on the [LED screen](/device/screen), meaning to turn it on (
|
||||
led.toggle(0,0)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* x - [Number](/types/number); the *x coordinate* or horizontal position (0, 1, 2, 3, 4)
|
||||
* y - [Number](/types/number); the *y coordinate* or vertical position (0, 1, 2, 3, 4)
|
||||
|
||||
If a parameter is [out of bounds](/reference/out-of-bounds) (a value other than 0-4), then this function will do nothing.
|
||||
|
||||
### x, y coordinates?
|
||||
## x, y coordinates?
|
||||
|
||||
The LED screen is made up of 25 LEDs arranged in a 5x5 grid. To figure out the ``x``, ``y`` coordinates, see [LED screen](/device/screen).
|
||||
|
||||
### Example
|
||||
## Example
|
||||
|
||||
This code toggles the centre LED:
|
||||
|
||||
@ -25,7 +25,7 @@ This code toggles the centre LED:
|
||||
led.toggle(2, 2)
|
||||
```
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[toggle all](/reference/led/toggle-all), [plot](/reference/led/plot), [unplot](/reference/led/unplot), [point](/reference/led/point), [LED screen](/device/screen),
|
||||
|
||||
|
@ -12,7 +12,7 @@ Use [plot](/reference/led/plot) to turn **on** an LED.
|
||||
|
||||
## ~
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* ``x`` is a [number](/types/number) that means the
|
||||
horizontal spot on the LED screen (from left to right: 0, 1, 2, 3,
|
||||
@ -23,15 +23,15 @@ Use [plot](/reference/led/plot) to turn **on** an LED.
|
||||
If a parameter is [out of bounds](/reference/out-of-bounds) (a value
|
||||
other than 0 to 4), then this function will do nothing.
|
||||
|
||||
### ~hint
|
||||
## ~hint
|
||||
|
||||
The LED screen is a solid square of LEDs with five LEDs on each side.
|
||||
To learn more about how you number the LEDs with ``x`` and ``y``
|
||||
coordinates, see [LED screen](/device/screen).
|
||||
|
||||
### ~
|
||||
## ~
|
||||
|
||||
### Example: Center off
|
||||
## Example: Center off
|
||||
|
||||
This program shows a picture on the LED screen, and then turns off the center LED with `unplot`.
|
||||
|
||||
@ -47,14 +47,14 @@ basic.pause(500)
|
||||
led.unplot(2, 2)
|
||||
```
|
||||
|
||||
### ~hint
|
||||
## ~hint
|
||||
|
||||
Use the [point](/reference/led/point) function to find out if an LED is
|
||||
on or off.
|
||||
|
||||
### ~
|
||||
## ~
|
||||
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[plot](/reference/led/plot), [point](/reference/led/point), [LED screen](/device/screen)
|
||||
|
Reference in New Issue
Block a user