More fixes from the Lancaster doc review. (#453)
This commit is contained in:
parent
1031a1262f
commit
8e730f619c
@ -1,6 +1,6 @@
|
||||
# Images
|
||||
|
||||
Creation, manipulation and display of LED images.
|
||||
Create, show, and scroll images on the LED display.
|
||||
|
||||
```cards
|
||||
images.createImage(`
|
||||
@ -17,8 +17,15 @@ images.createBigImage(`
|
||||
. . . . .
|
||||
. . . . .
|
||||
`);
|
||||
images.createImage(``).showImage(0);
|
||||
images.createImage(``).scrollImage(0,0);
|
||||
images.arrowImage(ArrowNames.North)
|
||||
images.iconImage(IconNames.Heart)
|
||||
images.arrowNumber(ArrowNames.North)
|
||||
```
|
||||
|
||||
### See Also
|
||||
|
||||
[createImage](/reference/images/create-image), [createBigImage](/reference/images/create-big-image)
|
||||
[createImage](/reference/images/create-image), [createBigImage](/reference/images/create-big-image),
|
||||
[showImage](/reference/images/show-image), [scrollImage](/reference/images/scroll-image),
|
||||
[arrowImage](/reference/images/arrow-image), [iconImage](/reference/images/icon-image), [arrowNumber](/reference/images/arrow-number)
|
||||
|
41
docs/reference/images/arrow-image.md
Normal file
41
docs/reference/images/arrow-image.md
Normal file
@ -0,0 +1,41 @@
|
||||
# arrow Image
|
||||
|
||||
Create an arrow shaped [image](/reference/images/image) for the [LED screen](/device/screen).
|
||||
|
||||
```sig
|
||||
images.arrowImage(ArrowNames.North)
|
||||
```
|
||||
|
||||
The arrow points in the direction of the arrow name you choose, like `North`.
|
||||
|
||||
## Parameters
|
||||
|
||||
* **i**: the arrow name to make an arrow [image](/reference/images/image) for. You can make an arrow image that points in one of these directions:
|
||||
|
||||
>* `North`
|
||||
* `NorthEast`
|
||||
* `East`
|
||||
* `SouthEast`
|
||||
* `South`
|
||||
* `SouthWest`
|
||||
* `West`
|
||||
* `NorthWest`
|
||||
|
||||
## Example
|
||||
|
||||
Display a left arrow when button A is pressed or a right arrow when button B is pressed.
|
||||
|
||||
```blocks
|
||||
let arrowLeft = images.arrowImage(ArrowNames.West)
|
||||
let arrowRight = images.arrowImage(ArrowNames.East)
|
||||
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
arrowLeft.showImage(0);
|
||||
});
|
||||
input.onButtonPressed(Button.B, () => {
|
||||
arrowRight.showImage(0);
|
||||
});
|
||||
```
|
||||
## See also
|
||||
|
||||
[arrow number](/reference/images/arrow-number)
|
33
docs/reference/images/arrow-number.md
Normal file
33
docs/reference/images/arrow-number.md
Normal file
@ -0,0 +1,33 @@
|
||||
# arrow Number
|
||||
|
||||
Get the number that matches an arrow image name.
|
||||
|
||||
```sig
|
||||
images.arrowNumber(ArrowNames.North)
|
||||
```
|
||||
|
||||
Each arrow image name has a number for it. You can find the number for any arrow name with ``||arrow number||``.
|
||||
|
||||
## Parameters
|
||||
|
||||
* **arrow**: the arrow name to get an arrow number for. These are the arrow names:
|
||||
|
||||
>* `North`
|
||||
* `NorthEast`
|
||||
* `East`
|
||||
* `SouthEast`
|
||||
* `South`
|
||||
* `SouthWest`
|
||||
* `West`
|
||||
* `NorthWest`
|
||||
|
||||
## Example
|
||||
|
||||
Get the arrow number for `ArrowNames.South`.
|
||||
|
||||
```blocks
|
||||
let arrowSouthNumber = images.arrowNumber(ArrowNames.South)
|
||||
```
|
||||
## See also
|
||||
|
||||
[arrow image](/reference/images/arrow-image)
|
33
docs/reference/images/icon-image.md
Normal file
33
docs/reference/images/icon-image.md
Normal file
@ -0,0 +1,33 @@
|
||||
# icon Image
|
||||
|
||||
Create an icon [image](/reference/images/image) for the [LED screen](/device/screen).
|
||||
|
||||
```sig
|
||||
images.iconImage(IconNames.Heart);
|
||||
```
|
||||
|
||||
There are lots of pre-made icon images you can use to display on the [LED screen](/device/screen) of the @boardname@. You choose an icon by its name.
|
||||
|
||||
## Parameters
|
||||
|
||||
* **i**: the icon name of the image you want to show on the [LED screen](/device/screen). You pick an icon image such as: `IconNames.Heart`.
|
||||
|
||||
## Example
|
||||
|
||||
Show a happy face when button A is pressed or a sad face when button B is pressed.
|
||||
|
||||
```blocks
|
||||
let iamHappy = images.iconImage(IconNames.Happy)
|
||||
let iamSad = images.iconImage(IconNames.Sad)
|
||||
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
iamHappy.showImage(0);
|
||||
});
|
||||
input.onButtonPressed(Button.B, () => {
|
||||
iamSad.showImage(0);
|
||||
});
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
[arrow image](/reference/images/arrow-image)
|
@ -6,6 +6,8 @@ Generation of music tones through pin ``P0``.
|
||||
music.playTone(0, 0);
|
||||
music.ringTone(0);
|
||||
music.rest(0);
|
||||
music.beginMelody(music.builtInMelody(Melodies.Entertainer), MelodyOptions.Once);
|
||||
music.onEvent(MusicEvent.MelodyNotePlayed, () => {});
|
||||
music.beat(BeatFraction.Whole);
|
||||
music.tempo();
|
||||
music.changeTempoBy(20);
|
||||
@ -14,5 +16,6 @@ music.setTempo(120);
|
||||
|
||||
### See Also
|
||||
|
||||
[playTone](/reference/music/play-tone), [ringTone](/reference/music/ring-tone), [rest](/reference/music/rest), [beat](/reference/music/beat), [tempo](/reference/music/tempo), [changeTempoBy](/reference/music/change-tempo-by), [setTempo](/reference/music/set-tempo),
|
||||
[setPlayTone](/reference/music/set-play-tone), [onEvent](/reference/music/on-event)
|
||||
[playTone](/reference/music/play-tone), [ringTone](/reference/music/ring-tone), [rest](/reference/music/rest),
|
||||
[beginMelody](/reference/music/begin-melody), [onEvent](/reference/music/on-event),
|
||||
[beat](/reference/music/beat), [tempo](/reference/music/tempo), [changeTempoBy](/reference/music/change-tempo-by), [setTempo](/reference/music/set-tempo),
|
||||
|
@ -208,6 +208,7 @@ namespace basic {
|
||||
namespace images {
|
||||
|
||||
//% weight=50 blockGap=8
|
||||
//% help=images/arrow-image
|
||||
//% blockId=builtin_arrow_image block="arrow image %i=device_arrow"
|
||||
export function arrowImage(i: ArrowNames): Image {
|
||||
switch (i) {
|
||||
@ -271,6 +272,7 @@ namespace images {
|
||||
}
|
||||
|
||||
//% weight=50 blockGap=8
|
||||
//% help=images/icon-image
|
||||
//% blockId=builtin_image block="icon image %i"
|
||||
export function iconImage(i: IconNames): Image {
|
||||
switch (i) {
|
||||
@ -532,6 +534,7 @@ namespace images {
|
||||
}
|
||||
|
||||
//% weight=50 blockGap=8
|
||||
//% help=images/arrow-number
|
||||
//% blockId=device_arrow block="%arrow"
|
||||
//% shim=TD_ID
|
||||
export function arrowNumber(arrow: ArrowNames): number {
|
||||
|
Loading…
Reference in New Issue
Block a user