Skip to content

Instantly share code, notes, and snippets.

@magicus
Last active July 19, 2024 16:37
Show Gist options
  • Save magicus/fe591b74a67b7e0586bbd288abe85163 to your computer and use it in GitHub Desktop.
Save magicus/fe591b74a67b7e0586bbd288abe85163 to your computer and use it in GitHub Desktop.
micro:bit fast icon display
// save as custom.ts
namespace basic {
/**
* Draws the selected icon on the LED screen without delay
* @param icon the predefined icon id
*/
//% weight=90 blockGap=8
//% blockId=basic_fast_icon
//% block="fast icon %i" icon="\uf00a"
//% parts="ledmatrix"
//% icon.fieldEditor="imagedropdown"
//% icon.fieldOptions.columns="5"
//% icon.fieldOptions.width="380"
//% icon.fieldOptions.maxRows=4
export function fastIcon(icon: IconNames) {
let res = images.iconImage(icon)
res.showImage(0, 0)
}
/**
* Draws an arrow on the LED screen without delay
* @param direction the direction of the arrow
*/
//% weight=50 blockGap=8
//% blockId=basic_fast_arrow
//% block="fast arrow %i=device_arrow"
//% parts="ledmatrix"
export function fastArrow(direction: number) {
let res = images.arrowImage(direction)
res.showImage(0, 0)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment