radio blocks to read/stream value pairs

This commit is contained in:
Peli de Halleux
2016-05-09 22:55:37 -07:00
parent 07e8610e5d
commit e8887f5904
2 changed files with 75 additions and 0 deletions

View File

@@ -13,6 +13,25 @@ declare namespace radio {
//% blockId=radio_datagram_send_numbers block="send numbers|0: %VALUE0|1: %VALUE1|2: %VALUE2|3: %VALUE3" shim=radio::sendNumbers
function sendNumbers(value_0: number, value_1: number, value_2: number, value_3: number): void;
/**
* Broadcasts a name / value pair along with the device serial number
* and running time to any connected BBC micro:bit in the group.
* @param name the field name (max 12 characters), eg: "data"
* @param the numberic value
*/
//% help=radio/stream-value
//% weight=15
//% blockId=radio_datagram_stream_value block="stream|value %name|= %value" shim=radio::streamValue
function streamValue(name: string, number: number): void;
/**
* Reads a value sent with `stream value` and writes it
* to the serial stream as JSON
*/
//% help=radio/read-value-to-serial
//% weight=14 shim=radio::readValueToSerial
function readValueToSerial(): void;
/**
* Registers code to run when a packet is received over radio.
*/