pxt-calliope/docs/reference/led/point.md
2016-03-25 16:47:20 -07:00

1.1 KiB

Point

Get the on/off state of a LED on the LED screen. Specify the LED using x, y coordinates.

led.point(0,0);

Parameters

  • x - Number; the x coordinate or horizontal position (0, 1, 2, 3, 4)
  • y - Number; the y coordinate or vertical position (0, 1, 2, 3, 4)

If a parameter is out of bounds (a value other than 0-4), then this function will return false.

Returns

  • Boolean - true if the LED is on and false if the LED is off

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.

Example: toggle off

If point(1, 1) returns true, then the following code turns off the LED:

if (led.point(1, 1)) {
    led.unplot(1, 1)
}

See also

unplot, plot, LED screen, create image