I made a customblock for a row of 12 LEDs on a I2C IOExpander. So I used imageliteral to create a clickable row of 12 LEDs.
This runs fine in Simulator, but not on the microbit. With makecode beta on Edge Win10 it generates an error when clicking Download on a paired microbit.
//% color=#0fbc11 icon="\uf2db"
namespace MCP23017 {
//% block="clickLED"
//% imageLiteral=1
//% imageLiteralColumns=12
//% imageLiteralRows=1
//% shim=images::createImage
export function clickLED(i: String): void {
const im = <Image><any>i;
im.showImage(0) // shows on LED Matrix for Test
im.showImage(5)
// im.showImage(10)
for (let column = 0; column < 12; column++) {
if (im.pixel(column, 0)) {
// setLed(column+1,State.High)
basic.showNumber(column)
} else {
//setLed(column+1,State.Low)
}
}
}
}
@peli: your testprogram Help with block field editors - large image grid picker? runs in simulator, too but not on a real micro:bit
Any Idea? Thanks!
Michael