support for interval in "show icon", "show arrow"
This commit is contained in:
@ -6,6 +6,12 @@ Shows the selected arrow on the LED screen
|
||||
basic.showArrow(ArrowNames.North)
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
* ``direction``, the identifier of the arrow to display
|
||||
* ``interval`` (optional), the time to display in milliseconds. default is 400.
|
||||
|
||||
### Example
|
||||
|
||||
This program shows all eight arrows.
|
||||
|
@ -6,6 +6,11 @@ Shows the selected icon on the LED screen
|
||||
basic.showIcon(IconNames.Heart)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
* ``icon``, the identifier of the icon to display
|
||||
* ``interval`` (optional), the time to display in milliseconds. default is 400.
|
||||
|
||||
### Example
|
||||
|
||||
This program shows a happy face and then a sad face with the ``show icon`` function, with a one second pause in between.
|
||||
|
@ -36,7 +36,12 @@
|
||||
"basic.showAnimation": "Shows a sequence of LED screens as an animation.",
|
||||
"basic.showAnimation|param|interval": "time in milliseconds between each redraw",
|
||||
"basic.showAnimation|param|leds": "pattern of LEDs to turn on/off",
|
||||
"basic.showArrow": "Shows an arrow on screent",
|
||||
"basic.showArrow|param|direction": "the direction of the arrow",
|
||||
"basic.showArrow|param|interval": "the amount of time (milliseconds) to show the icon. Default is 600.",
|
||||
"basic.showIcon": "Draws the selected icon on the LED screen",
|
||||
"basic.showIcon|param|icon": "the predifined icon id",
|
||||
"basic.showIcon|param|interval": "the amount of time (milliseconds) to show the icon. Default is 600.",
|
||||
"basic.showLeds": "Draws an image on the LED screen.",
|
||||
"basic.showLeds|param|interval": "time in milliseconds to pause after drawing",
|
||||
"basic.showLeds|param|leds": "the pattern of LED to turn on/off",
|
||||
|
@ -191,6 +191,7 @@
|
||||
"basic.clearScreen|block": "clear screen",
|
||||
"basic.forever|block": "forever",
|
||||
"basic.pause|block": "pause (ms) %pause",
|
||||
"basic.showArrow|block": "show arrow %i=device_arrow",
|
||||
"basic.showIcon|block": "show icon %i",
|
||||
"basic.showLeds|block": "show leds",
|
||||
"basic.showNumber|block": "show|number %number",
|
||||
|
@ -171,6 +171,8 @@ namespace basic {
|
||||
|
||||
/**
|
||||
* Draws the selected icon on the LED screen
|
||||
* @param icon the predifined icon id
|
||||
* @param interval the amount of time (milliseconds) to show the icon. Default is 600.
|
||||
*/
|
||||
//% weight=90 blockGap=8
|
||||
//% blockId=basic_show_icon
|
||||
@ -180,20 +182,25 @@ namespace basic {
|
||||
//% i.fieldEditor="gridpicker"
|
||||
//% i.fieldOptions.width="400" i.fieldOptions.columns="5"
|
||||
//% i.fieldOptions.itemColour="black" i.fieldOptions.tooltips="true"
|
||||
export function showIcon(icon: IconNames) {
|
||||
export function showIcon(icon: IconNames, interval = 600) {
|
||||
let res = images.iconImage(icon)
|
||||
res.showImage(0)
|
||||
res.showImage(0, interval)
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows an arrow on screent
|
||||
* @param direction the direction of the arrow
|
||||
* @param interval the amount of time (milliseconds) to show the icon. Default is 600.
|
||||
*/
|
||||
//% weight=50 blockGap=8
|
||||
//% blockId=basic_show_arrow
|
||||
//% block="show arrow %i=device_arrow"
|
||||
//% parts="ledmatrix"
|
||||
//% advanced=true
|
||||
//% help=basic/show-arrow
|
||||
export function showArrow(i: number) {
|
||||
let res = images.arrowImage(i)
|
||||
res.showImage(0)
|
||||
export function showArrow(direction: number, interval = 600) {
|
||||
let res = images.arrowImage(direction)
|
||||
res.showImage(0, interval)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user