Add in 'console' doc stuff (#342)
* Add 'playSound' api docs * Add in 'console' doc stuff * Add 'send to screen' in summary\
This commit is contained in:
parent
60ec3f1c99
commit
8ee63df325
@ -129,3 +129,7 @@
|
|||||||
* [millis](/reference/control/timer/millis)
|
* [millis](/reference/control/timer/millis)
|
||||||
* [reset](/reference/control/timer/reset)
|
* [reset](/reference/control/timer/reset)
|
||||||
* [pause until](/reference/control/timer/pause-until)
|
* [pause until](/reference/control/timer/pause-until)
|
||||||
|
* [Console](/reference/console)
|
||||||
|
* [log](/reference/console/log)
|
||||||
|
* [log value](/reference/console/log-value)
|
||||||
|
* [send to screen](/reference/console/send-to-screen)
|
||||||
|
@ -1,15 +1,22 @@
|
|||||||
# Reference
|
# Reference
|
||||||
|
|
||||||
```namespaces
|
```namespaces
|
||||||
control.runInParallel(function(){});
|
|
||||||
sensors.color(null);
|
sensors.color(null);
|
||||||
motors.stopAll();
|
motors.stopAll();
|
||||||
brick.showMood(moods.sleeping);
|
brick.showMood(moods.sleeping);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Advanced
|
||||||
|
|
||||||
|
```namespaces
|
||||||
|
console.log("");
|
||||||
|
control.runInParallel(function(){});
|
||||||
|
```
|
||||||
|
|
||||||
## See Also
|
## See Also
|
||||||
|
|
||||||
[brick](/reference/brick),
|
[brick](/reference/brick),
|
||||||
[sensors](/reference/sensors),
|
[sensors](/reference/sensors),
|
||||||
[motors](/reference/motors),
|
[motors](/reference/motors),
|
||||||
[control](/reference/control)
|
[control](/reference/control),
|
||||||
|
[console](/reference/console)
|
||||||
|
15
docs/reference/console.md
Normal file
15
docs/reference/console.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# Console
|
||||||
|
|
||||||
|
Output text and data values to the console.
|
||||||
|
|
||||||
|
```cards
|
||||||
|
console.log("");
|
||||||
|
console.logValue("x", 0);
|
||||||
|
console.sendToScreen();
|
||||||
|
```
|
||||||
|
|
||||||
|
## See also
|
||||||
|
|
||||||
|
[log](/reference/console/log),
|
||||||
|
[log value](/reference/console/log-value),
|
||||||
|
[send to screen](/reference/console/send-to-screen)
|
26
docs/reference/console/send-to-screen.md
Normal file
26
docs/reference/console/send-to-screen.md
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# send To Screen
|
||||||
|
|
||||||
|
Direct the console output to go to the @boardname@ screen.
|
||||||
|
|
||||||
|
```sig
|
||||||
|
console.sendToScreen();
|
||||||
|
```
|
||||||
|
|
||||||
|
A "console" is a place for a user to see special messages from a device. It could be something connected to a serial port, a display that shows text, or even a text file. A console is typically used as a place to send information that is added to a message _log_ (a record of messages that are sent from a device). Your program can send log messages using the [console](/reference/console) functions. The MakeCode editor has a console view that lets you see the console output when your program runs in the simulator.
|
||||||
|
|
||||||
|
On the @boardname@, the screen can serve as a console too and you can make your console output go there. Before using the console log functions, set the screen as the console output location.
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
Direct the console output to go to the screen. Show 20 values on the screen. Use the up and down buttons to scroll through the values.
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
console.sendToScreen()
|
||||||
|
for (let index = 0; index <= 20; index++) {
|
||||||
|
console.logValue("index", index)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## See also
|
||||||
|
|
||||||
|
[log](reference/console/log), [log value](/reference/console/log-value)
|
@ -51,6 +51,7 @@ namespace console {
|
|||||||
*/
|
*/
|
||||||
//% blockId=logsendtostreen block="send console to screen"
|
//% blockId=logsendtostreen block="send console to screen"
|
||||||
//% weight=1
|
//% weight=1
|
||||||
|
//% help=console/send-to-screen
|
||||||
export function sendToScreen(): void {
|
export function sendToScreen(): void {
|
||||||
console.screen.attach();
|
console.screen.attach();
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ namespace control {
|
|||||||
*/
|
*/
|
||||||
//% weight=21 blockGap=12 blockId="control_raise_event"
|
//% weight=21 blockGap=12 blockId="control_raise_event"
|
||||||
//% block="raise event|from %src|with value %value" blockExternalInputs=1
|
//% block="raise event|from %src|with value %value" blockExternalInputs=1
|
||||||
|
//% help=control/raise-event
|
||||||
void raiseEvent(int src, int value) {
|
void raiseEvent(int src, int value) {
|
||||||
pxt::raiseEvent(src, value);
|
pxt::raiseEvent(src, value);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user