bring back 'write number'
This commit is contained in:
parent
24f2a45310
commit
26841de6cf
@ -32,5 +32,5 @@ basic.forever(() => {
|
|||||||
|
|
||||||
### See also
|
### See also
|
||||||
|
|
||||||
[serial](/device/serial), [write value](/reference/serial/write-value)
|
[serial](/device/serial), [write line](/reference/serial/write-line)
|
||||||
|
|
||||||
|
@ -14,17 +14,24 @@ namespace serial {
|
|||||||
writeString("\r\n");
|
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.
|
* Writes a ``name: value`` pair line to the serial.
|
||||||
* @param name name of the value stream, eg: x
|
* @param name name of the value stream, eg: x
|
||||||
* @param value to write
|
* @param value to write
|
||||||
*/
|
*/
|
||||||
//% help=/reference/serial/write-value
|
|
||||||
//% weight=80
|
//% weight=80
|
||||||
//% blockId=serial_writevalue block="serial|write %name|= %value"
|
//% blockId=serial_writevalue block="serial|write %name|= %value"
|
||||||
export function writeValue(name: string, value: number): void {
|
export function writeValue(name: string, value: number): void {
|
||||||
writeString(name);
|
writeString(name);
|
||||||
writeString(":");
|
writeString(": ");
|
||||||
writeLine(value.toString());
|
writeNumber(value);
|
||||||
|
writeLine("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user