pxt-calliope/docs/reference/led/point.md

38 lines
1.1 KiB
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# Point
2016-04-13 17:27:45 +02:00
Get the on/off state of a LED on the [LED screen](/device/screen). Specify the LED using x, y coordinates.
2016-03-26 00:47:20 +01:00
```sig
led.point(0,0);
```
### Parameters
2016-04-13 17:27:45 +02:00
* x - [Number](/reference/types/number); the *x coordinate* or horizontal position (0, 1, 2, 3, 4)
* y - [Number](/reference/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 return `false`.
2016-03-26 00:47:20 +01:00
### Returns
2016-04-13 17:27:45 +02:00
* [Boolean](/reference/types/boolean) - `true` if the LED is *on* and `false` if the LED is *off*
2016-03-26 00:47:20 +01:00
### x, y coordinates?
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
### Example: toggle off
If `point(1, 1)` returns `true`, then the following code turns off the LED:
```blocks
if (led.point(1, 1)) {
led.unplot(1, 1)
}
```
### See also
2016-04-13 17:27:45 +02:00
[unplot](/reference/led/unplot), [plot](/reference/led/plot), [LED screen](/device/screen), [create image](/reference/images/create-image)
2016-03-26 00:47:20 +01:00