added serial docs

This commit is contained in:
Peli de Halleux
2016-04-15 16:36:31 -07:00
parent d7c3f1b50a
commit 67c5f0612a
6 changed files with 150 additions and 11 deletions

View File

@ -7,30 +7,24 @@ namespace serial {
* Prints a line of text to the serial
* @param value to send over serial
*/
//% help=/reference/serial/write-line
//% blockId=serial_writeline block="serial|write %text"
export function writeLine(text: string): void {
writeString(text);
writeString("\r\n");
}
/**
* Prints a numeric value to the serial
*/
export function writeNumber(value: number): void {
writeString(value.toString());
}
/**
* Writes a ``name: value`` pair line to the serial.
* @param name name of the value stream, eg: x
* @param value to write
*/
//% help=/reference/serial/write-value
//% weight=80
//% blockId=serial_writevalue block="serial|write %name|= %value"
export function writeValue(name: string, value: number): void {
writeString(name);
writeString(": ");
writeNumber(value);
writeLine("");
writeString(":");
writeLine(value.toString());
}
}