Start on the 'brick' api topics (#280)

* Start on the 'brick' api topics

* Add the delay to clear screen example

* Better output for clearsceen example
This commit is contained in:
Galen Nickel
2018-01-30 17:02:22 -08:00
committed by Peli de Halleux
parent e06659ab4c
commit 4f70d341e4
14 changed files with 222 additions and 9 deletions

View File

@ -0,0 +1,22 @@
# clear Screen
Clear any text or numbers displayed on the screen. The screen will be blank.
```sig
brick.clearScreen();
```
## Example
Clear the screen after displaying the message.
```blocks
brick.showString("This message will", 1);
brick.showString("self-destruct in:", 2);
brick.showString("seconds", 5);
for (let i = 0; i < 10; i++) {
brick.showNumber(10 - i, 4);
loops.pause(1000);
}
brick.clearScreen();
```

View File

@ -0,0 +1,19 @@
# print Ports
Print the status of the ports on the screen.
```sig
brick.printPorts();
```
## Example
Show the port status.
```blocks
brick.printPorts();
```
## See also
[show string](/reference/brick/show-string), [show value](/reference/brick/show-value)

View File

@ -0,0 +1,24 @@
# show Image
Show an image on the brick's display.
```sig
brick.showImage(images.expressionsBigSmile);
```
You can choose one of several images to show on the display.
## Parameters
**image**: A image to show on the brick's display. Use the image picker to choose the image you want to show.
## Example
Show a sleeping image on the brick's display.
```blocks
brick.showImage(image.expressionsZzz)
```
## See also
[show image](/reference/brick/show-mood)

View File

@ -0,0 +1,37 @@
# show Mood
Show a mood on the brick. A mood will have a image on the display along with a sound and solid or flashing light.
```sig
brick.showMood(moods.sleeping)
```
You can choose one of several moods to show on the display. Use a mood to help show what your @boardname@ is doing at the moment.
## Parameters
**mood**: A mood to show on the brick. Choose one of these moods:
>* ``sleeping``
* ``awake``
* ``tired``
* ``angry``
* ``sad``
* ``dizzy``
* ``knockedOut``
* ``middleLeft``
* ``middleRight``
* ``love``
* ``winking``
* ``neutral``
## Example
Show a ``winking`` mood on the brick.
```blocks
brick.showMood(moods.winking)
```
## See also
[show image](/reference/brick/show-image)

View File

@ -0,0 +1,24 @@
# show Number
Show a number on the screen at the line you select.
```sig
brick.showNumber(0, 1);
```
## Parameters
**value**: a [number](/types/number) to show on the brick's screen.
**line**: The line number on the screen where the value is displayed. The line numbers for the screen start with line `1`.
## Example
Show the number `1000` on the screen.
```blocks
brick.showNumber(1000, 1);
```
## See also
[show string](/reference/brick/show-string), [show value](/reference/brick/show-value)

View File

@ -0,0 +1,27 @@
# show String
Show some text on a the screen at the line you select.
```sig
brick.showString("Hello world", 1)
```
## Parameters
* **text**: a [string](/types/string) to show on the brick's screen.
* **line**: the line [number](/types/number) on the screen where the text is displayed. The line numbers for the screen start with line `1`.
## Example
Show a greeting on the screen. Then, respond with another message when ENTER is pressed.
```blocks
brick.showString("Hello, I dare you to press ENTER...", 1);
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
brick.showString("Hey! Don't push my buttons.", 3);
});
```
## See also
[show number](/reference/brick/show-number)

View File

@ -0,0 +1,29 @@
# show Value
Show a name-value-pair on the screen at the line you select.
```sig
brick.showNumber("item", 0, 1);
```
Name-value-pairs are used to report data values to the screen. If you want to show the current temperature on the screen, you might use `"temp"` as the data name for the the value.
## Parameters
* **name**: a [string](/types/string) which is the name of the data value.
**value**: a [number](/types/number) to show on the brick's screen.
**line**: The line number on the screen where the value is displayed. The line numbers for the screen start with line `1`.
## Example
Show the current amount of ambient light detected by sensor 2.
```blocks
brick.buttonEnter.onEvent(ButtonEvent.Click, function () {
brick.showValue("color", sensors.color2.light(LightIntensityMode.Ambient), 1)
})
```
## See also
[show number](/reference/brick/show-number)