@ -6,7 +6,7 @@ Turn off all the LED lights on the [LED screen](/device/screen).
|
||||
basic.clearScreen()
|
||||
```
|
||||
|
||||
### Example: Vanishing heart
|
||||
## Example: Vanishing heart
|
||||
|
||||
The following code shows a heart on the screen and then turns off all the LED lights.
|
||||
|
||||
@ -21,7 +21,7 @@ basic.showLeds(`
|
||||
basic.clearScreen()
|
||||
```
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[set brightness](/reference/led/set-brightness), [unplot](/reference/led/unplot), [plot](/reference/led/plot), [Image](/reference/images/image)
|
||||
|
||||
|
@ -8,7 +8,7 @@ basic.forever(() => {
|
||||
})
|
||||
```
|
||||
|
||||
### Example: compass
|
||||
## Example: compass
|
||||
|
||||
The following example constantly checks the
|
||||
[compass heading](/reference/input/compass-heading)
|
||||
@ -31,7 +31,7 @@ basic.forever(() => {
|
||||
})
|
||||
```
|
||||
|
||||
### Example: counter
|
||||
## Example: counter
|
||||
|
||||
The following example keeps showing the [number](/types/number) stored in a global variable.
|
||||
When you press button `A`, the number gets bigger.
|
||||
@ -47,7 +47,7 @@ input.onButtonPressed(Button.A, () => {
|
||||
})
|
||||
```
|
||||
|
||||
### Competing for the LED screen
|
||||
## Competing for the LED screen
|
||||
|
||||
If different parts of a program are each trying
|
||||
to show something on the LED screen at the same time,
|
||||
@ -63,7 +63,7 @@ input.onButtonPressed(Button.A, () => {
|
||||
})
|
||||
```
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[while](/blocks/loops/while), [on button pressed](/reference/input/on-button-pressed), [in background](/reference/control/in-background)
|
||||
|
||||
|
@ -7,11 +7,11 @@ You can use this function to slow your program down.
|
||||
basic.pause(400)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* ``ms`` is the number of milliseconds that you want to pause (100 milliseconds = 1/10 second, and 1000 milliseconds = 1 second).
|
||||
|
||||
### Example: diagonal line
|
||||
## Example: diagonal line
|
||||
|
||||
This example draws a diagonal line by turning on LED `0, 0` (top left) through LED `4, 4` (bottom right).
|
||||
The program pauses 500 milliseconds after turning on each LED.
|
||||
@ -24,7 +24,7 @@ for (let i = 0; i < 5; i++) {
|
||||
}
|
||||
```
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[while](/blocks/loops/while), [running time](/reference/input/running-time), [for](/blocks/loops/for)
|
||||
|
||||
|
@ -12,11 +12,11 @@ basic.showLeds(`
|
||||
`)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* leds - a series of LED on/off states that form an image (see steps below)
|
||||
|
||||
### Example: smiley
|
||||
## Example: smiley
|
||||
|
||||
```blocks
|
||||
basic.showLeds(`
|
||||
@ -28,7 +28,7 @@ basic.showLeds(`
|
||||
`)
|
||||
```
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[show animation](/reference/basic/show-animation), [image](/reference/images/image), [show image](/reference/images/show-image), [scroll image](/reference/images/scroll-image)
|
||||
|
||||
|
@ -12,12 +12,12 @@ basic.showAnimation(`
|
||||
`)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* `leds` is a [string](/types/string) that shows which LEDs are on and off, in groups one after another.
|
||||
* `interval` is an optional [number](/types/number). It means the number of milliseconds to pause after each image frame.
|
||||
|
||||
### Example: Animating a group of image frames
|
||||
## Example: Animating a group of image frames
|
||||
|
||||
In this animation, each row is 15 spaces wide because
|
||||
there are three frames in the animation, and each frame is
|
||||
@ -33,13 +33,13 @@ basic.showAnimation(`
|
||||
`)
|
||||
```
|
||||
|
||||
### ~hint
|
||||
## ~hint
|
||||
|
||||
If the animation is too fast, make `interval` bigger.
|
||||
|
||||
### ~
|
||||
## ~
|
||||
|
||||
### Example: animating frames with a pause
|
||||
## Example: animating frames with a pause
|
||||
|
||||
This example shows six frames on the screen, pausing 500 milliseconds after each frame.
|
||||
|
||||
@ -57,8 +57,8 @@ basic.showAnimation(`
|
||||
`, 500)
|
||||
```
|
||||
|
||||
### ~hint
|
||||
## ~hint
|
||||
|
||||
Use [forever](/reference/basic/forever) to show an animation over and over.
|
||||
|
||||
### ~
|
||||
## ~
|
||||
|
@ -7,12 +7,12 @@ basic.showArrow(ArrowNames.North)
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* ``direction``, the identifier of the arrow to display
|
||||
* ``interval`` (optional), the time to display in milliseconds. default is 400.
|
||||
|
||||
### Example
|
||||
## Example
|
||||
|
||||
This program shows all eight arrows.
|
||||
|
||||
@ -23,7 +23,7 @@ for (let index = 0; index <= 7; index++) {
|
||||
}
|
||||
```
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[showIcon](/reference/basic/show-icon),
|
||||
[showLeds](/reference/basic/show-leds)
|
@ -6,12 +6,12 @@ Shows the selected icon on the LED screen
|
||||
basic.showIcon(IconNames.Heart)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* ``icon``, the identifier of the icon to display
|
||||
* ``interval`` (optional), the time to display in milliseconds. default is 400.
|
||||
|
||||
### Example
|
||||
## Example
|
||||
|
||||
This program shows a happy face and then a sad face with the ``show icon`` function, with a one second pause in between.
|
||||
|
||||
@ -21,6 +21,6 @@ basic.pause(1000)
|
||||
basic.showIcon(IconNames.Sad)
|
||||
```
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[showLeds](/reference/basic/show-leds)
|
@ -13,13 +13,13 @@ basic.showLeds(`
|
||||
)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* `leds` is a [string](/types/string) that controls which LEDs are on and off.
|
||||
* `interval` is an optional [number](/types/number) that means how many milliseconds to wait after showing a picture.
|
||||
If you are programming with blocks, `interval` is set at 400 milliseconds.
|
||||
|
||||
### Example
|
||||
## Example
|
||||
|
||||
This program shows a picture with the ``show leds`` function.
|
||||
|
||||
@ -34,14 +34,14 @@ basic.showLeds(`
|
||||
)
|
||||
```
|
||||
|
||||
### ~hint
|
||||
## ~hint
|
||||
|
||||
If you are programming in JavaScript, `#` means an LED that is turned
|
||||
on and `.` means an LED that is turned off.
|
||||
|
||||
### ~
|
||||
## ~
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[plot leds](/reference/basic/plot-leds), [show animation](/reference/basic/show-animation)
|
||||
|
||||
|
@ -6,12 +6,12 @@ Show a number on the [LED screen](/device/screen). It will slide left if it has
|
||||
basic.showNumber(2)
|
||||
```
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* `value` is a [Number](/types/number).
|
||||
* `interval` is an optional [Number](/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:
|
||||
## Examples:
|
||||
|
||||
To show the number 10:
|
||||
|
||||
@ -26,7 +26,7 @@ let x = 1
|
||||
basic.showNumber(x)
|
||||
```
|
||||
|
||||
### Example: count to 5
|
||||
## Example: count to 5
|
||||
|
||||
This example uses a [for](/blocks/loops/for) loop to show numbers ``0`` through ``5`` on the screen:
|
||||
|
||||
@ -37,12 +37,12 @@ for (let i = 0; i < 6; i++) {
|
||||
}
|
||||
```
|
||||
|
||||
### Other show functions
|
||||
## Other show functions
|
||||
|
||||
* Use [show string](/reference/basic/show-string) to show a [String](/types/string) with letters on the screen.
|
||||
* Use [show animation](/reference/basic/show-animation) to show a group of pictures on the screen, one after another.
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[show string](/reference/basic/show-string), [show animation](/reference/basic/show-animation), [Number](/types/number), [math](/blocks/math)
|
||||
|
||||
|
@ -6,12 +6,12 @@ Show a number on the [LED screen](/device/screen). It will slide left if it is b
|
||||
basic.showString("Hello!")
|
||||
```
|
||||
|
||||
### Parameters
|
||||
## Parameters
|
||||
|
||||
* `text` is a [String](/types/string). It can contain letters, numbers, and punctuation.
|
||||
* `interval` is an optional [Number](/types/number). It means the number of milliseconds before sliding the [String](/types/string) left by one LED each time. Bigger intervals make the sliding slower.
|
||||
|
||||
### Examples:
|
||||
## Examples:
|
||||
|
||||
To show the word **Hello**:
|
||||
|
||||
@ -26,12 +26,12 @@ let s = "Hi"
|
||||
basic.showString(s)
|
||||
```
|
||||
|
||||
### Other show functions
|
||||
## Other show functions
|
||||
|
||||
* Use [show number](/reference/basic/show-number) to show a number on the [LED screen](/device/screen).
|
||||
* Use [show animation](/reference/basic/show-animation) to show a group of pictures on the screen, one after another.
|
||||
|
||||
### See also
|
||||
## See also
|
||||
|
||||
[String](/types/string), [show number](/reference/basic/show-number), [show animation](/reference/basic/show-animation)
|
||||
|
||||
|
Reference in New Issue
Block a user