The set pixel function. #set pixel.
Set the on/off state of pixel in an Image.
export function setPixel(_this: micro_bit.Image, x: number, y: number, value: boolean)
true for on, false for offTo figure out the x, y coordinates, see LED screen.
The following example creates an image and stores it in the img variable. The set pixel function sets the centre pixel off, before img is shown using show image.
let img = images.createImage(`
. . # . .
. # . # .
. . # . .
. # . # .
. . # . .
`)
img.setPixel(2, 2, false)
img.showImage(0)