Move files from main kindscript repo

This commit is contained in:
Michal Moskal
2016-03-10 14:01:04 -08:00
parent a0f7ddd1be
commit 1a17bfac04
39 changed files with 2633 additions and 0 deletions

View File

@ -0,0 +1,4 @@
# serial
The serial library.

View File

@ -0,0 +1,59 @@
//% weight=1
namespace serial {
/**
* Prints a line of text to the serial
* @param value to send over serial
*/
//% 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());
}
/**
* Reads a line of text from the serial port.
*/
//% shim=micro_bit::serialReadString
export function readString(): string {
return ""
}
/**
* Sends a piece of text through Serial connection.
*/
//% shim=micro_bit::serialSendString
export function writeString(text: string): void { }
/**
* Sends the current pixel values, byte-per-pixel, over serial.
*/
//% shim=micro_bit::serialSendDisplayState
export function writeScreen(): void { }
/**
* Reads the screen from serial.
*/
//% shim=micro_bit::serialReadDisplayState
export function readScreen(): void { }
/**
* Writes a ``name: value`` pair line to the serial.
* @param name name of the value stream, eg: x
* @param value to write
*/
//% weight=80
//% blockId=serial_writevalue block="serial|write %name|= %value"
export function writeValue(name: string, value: number): void {
writeString(name);
writeString(": ");
writeNumber(value);
writeLine("");
}
}

View File

@ -0,0 +1,13 @@
{
"name": "microbit-serial",
"description": "The serial services",
"files": [
"README.md",
"serial.ts"
],
"public": true,
"dependencies": {
"microbit": "file:../microbit"
},
"installedVersion": "vykmvx"
}