Simplified (but not oversimplified) show-string docs. Proposed new reference format.
This commit is contained in:
parent
217fce953d
commit
d7250d54f8
@ -1,6 +1,6 @@
|
|||||||
# Show Number
|
# Show Number
|
||||||
|
|
||||||
Show a number on the [LED screen](/device/screen), one digit at a time (scrolling from left to right)
|
Show a number on the [LED screen](/device/screen). It will slide left if it has more than one digit.
|
||||||
|
|
||||||
~~~~sig
|
~~~~sig
|
||||||
basic.showNumber(2, 150)
|
basic.showNumber(2, 150)
|
||||||
@ -8,18 +8,18 @@ basic.showNumber(2, 150)
|
|||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
* value - a [Number](/reference/types/number)
|
* **value** is a [Number](/reference/types/number).
|
||||||
* (optional) interval (ms) - [Number](/reference/types/number); the time (in milliseconds) before scrolling by one LED; the larger the number, the slower the scroll
|
* **interval (ms)** is an optional [Number](/reference/types/number). It means the number of milliseconds before sliding the **value** left by one LED each time. Bigger intervals make the sliding slower.
|
||||||
|
|
||||||
### ~
|
### Examples:
|
||||||
|
|
||||||
To display the number 10:
|
To show the number 10:
|
||||||
|
|
||||||
~~~~blocks
|
~~~~blocks
|
||||||
basic.showNumber(10)
|
basic.showNumber(10)
|
||||||
~~~~
|
~~~~
|
||||||
|
|
||||||
To display the number stored in the `x` variable:
|
To show the number stored in the `x` variable:
|
||||||
|
|
||||||
~~~~blocks
|
~~~~blocks
|
||||||
let x = 1
|
let x = 1
|
||||||
@ -28,19 +28,19 @@ basic.showNumber(x)
|
|||||||
|
|
||||||
### Example: count to 5
|
### Example: count to 5
|
||||||
|
|
||||||
This example uses a [for](/reference/loops/for) loop to show numbers ``1`` through ``5`` on the screen:
|
This example uses a [for](/reference/loops/for) loop to show numbers ``0`` through ``5`` on the screen:
|
||||||
|
|
||||||
~~~~blocks
|
~~~~blocks
|
||||||
for (let i = 0; i < 5; i++) {
|
for (let i = 0; i < 6; i++) {
|
||||||
basic.showNumber(i + 1)
|
basic.showNumber(i)
|
||||||
basic.pause(200)
|
basic.pause(200)
|
||||||
}
|
}
|
||||||
~~~~
|
~~~~
|
||||||
|
|
||||||
### Other show functions
|
### Other show functions
|
||||||
|
|
||||||
* use [show string](/reference/basic/show-string) to show a string on the screen
|
* use [show string](/reference/basic/show-string) to show a [String](/reference/types/string) with letters on the screen
|
||||||
* use [show animation](/reference/basic/show-animation) to show a series of images on the screen
|
* use [show animation](/reference/basic/show-animation) to show a group of pictures on the screen, one after another
|
||||||
|
|
||||||
### Lessons
|
### Lessons
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user