pxt-calliope/docs/reference/led/unplot.md
2016-04-13 08:27:45 -07:00

1.3 KiB

Unplot

Turn off a LED light on the LED screen. Specify which LED using x, y coordinates. Use plot to turn a LED on.

led.unplot(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), this function will do nothing.

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.

This code turns off centre LED:

led.unplot(2, 2)

Get the LED on/off state

Use the point function to find out if a LED is on or off.

Example: toggle off

This code creates and shows an image on the micro:bit screen, and then clears the centre LED using unplot:

basic.showLeds(`
. . # . .
. . # . .
# # # # #
. . # . .
. . # . .
`)
basic.pause(500)
led.unplot(2, 2)

Lessons

strobe light

See also

plot, point, LED screen, create image