2016-03-26 00:47:20 +01:00
|
|
|
# Toggle
|
|
|
|
|
2016-04-13 17:27:45 +02:00
|
|
|
Toggle a LED light on the [LED screen](/device/screen), meaning to turn it on (off) if it is off (on). Specify which LED using x, y coordinates.
|
2016-03-26 00:47:20 +01:00
|
|
|
|
|
|
|
```sig
|
|
|
|
led.toggle(0,0)
|
|
|
|
```
|
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
## Parameters
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
* 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)
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2016-04-13 17:27:45 +02:00
|
|
|
If a parameter is [out of bounds](/reference/out-of-bounds) (a value other than 0-4), then this function will do nothing.
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
## x, y coordinates?
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2016-04-13 17:27:45 +02:00
|
|
|
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).
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
## Example
|
2016-03-26 00:47:20 +01:00
|
|
|
|
|
|
|
This code toggles the centre LED:
|
|
|
|
|
|
|
|
```blocks
|
|
|
|
led.toggle(2, 2)
|
|
|
|
```
|
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
## See also
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2016-04-13 17:27:45 +02:00
|
|
|
[toggle all](/reference/led/toggle-all), [plot](/reference/led/plot), [unplot](/reference/led/unplot), [point](/reference/led/point), [LED screen](/device/screen),
|
2016-03-26 00:47:20 +01:00
|
|
|
|