2016-04-03 02:34:06 +02:00
|
|
|
// Auto-generated. Do not edit.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//% color=270 weight=34
|
|
|
|
declare namespace radio {
|
|
|
|
|
|
|
|
/**
|
2016-05-11 06:13:16 +02:00
|
|
|
* Broadcasts a number over radio to any connected micro:bit in the group.
|
2016-04-03 02:34:06 +02:00
|
|
|
*/
|
2016-05-11 06:13:16 +02:00
|
|
|
//% help=radio/send-number
|
|
|
|
//% weight=60
|
2016-08-02 01:02:06 +02:00
|
|
|
//% blockId=radio_datagram_send block="radio send number %value" blockGap=8 shim=radio::sendNumber
|
2016-05-11 06:13:16 +02:00
|
|
|
function sendNumber(value: number): void;
|
2016-04-03 02:34:06 +02:00
|
|
|
|
2016-05-10 07:55:37 +02:00
|
|
|
/**
|
|
|
|
* Broadcasts a name / value pair along with the device serial number
|
2016-08-02 01:02:06 +02:00
|
|
|
* and running time to any connected micro:bit in the group.
|
2016-05-10 07:55:37 +02:00
|
|
|
* @param name the field name (max 12 characters), eg: "data"
|
2016-05-11 06:13:16 +02:00
|
|
|
* @param value the numberic value
|
2016-05-10 07:55:37 +02:00
|
|
|
*/
|
2016-05-11 01:42:18 +02:00
|
|
|
//% help=radio/send-value
|
2016-05-11 06:13:16 +02:00
|
|
|
//% weight=59
|
2016-08-02 01:02:06 +02:00
|
|
|
//% blockId=radio_datagram_send_value block="radio send|value %name|= %value" blockGap=8 shim=radio::sendValue
|
2016-05-11 06:13:16 +02:00
|
|
|
function sendValue(name: string, value: number): void;
|
2016-05-10 07:55:37 +02:00
|
|
|
|
2016-05-12 21:35:40 +02:00
|
|
|
/**
|
|
|
|
* Broadcasts a number over radio to any connected micro:bit in the group.
|
|
|
|
*/
|
|
|
|
//% help=radio/send-string
|
|
|
|
//% weight=58
|
2016-08-02 01:02:06 +02:00
|
|
|
//% blockId=radio_datagram_send_string block="radio send string %msg" shim=radio::sendString
|
2016-05-12 21:35:40 +02:00
|
|
|
function sendString(msg: string): void;
|
|
|
|
|
2016-05-10 07:55:37 +02:00
|
|
|
/**
|
|
|
|
* Reads a value sent with `stream value` and writes it
|
|
|
|
* to the serial stream as JSON
|
|
|
|
*/
|
2016-05-11 06:13:16 +02:00
|
|
|
//% help=radio/write-value-to-serial
|
|
|
|
//% weight=3
|
2016-08-02 01:02:06 +02:00
|
|
|
//% blockId=radio_write_value_serial block="radio write value to serial" shim=radio::writeValueToSerial
|
2016-05-11 06:13:16 +02:00
|
|
|
function writeValueToSerial(): void;
|
2016-05-10 07:55:37 +02:00
|
|
|
|
2016-04-03 02:34:06 +02:00
|
|
|
/**
|
|
|
|
* Registers code to run when a packet is received over radio.
|
|
|
|
*/
|
|
|
|
//% help=radio/on-data-received
|
|
|
|
//% weight=50
|
2016-08-02 01:02:06 +02:00
|
|
|
//% blockId=radio_datagram_received_event block="radio on data received" blockGap=8 shim=radio::onDataReceived
|
2016-04-03 02:34:06 +02:00
|
|
|
function onDataReceived(body: () => void): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reads a number at a given index, between ``0`` and ``3``, from the packet received by ``receive number``. Not supported in simulator.
|
|
|
|
* @param index index of the number to read from 0 to 3. 1 eg
|
|
|
|
*/
|
|
|
|
//% help=radio/received-number-at
|
2016-05-11 01:42:18 +02:00
|
|
|
//% weight=45 debug=true
|
2016-08-02 01:02:06 +02:00
|
|
|
//% blockId=radio_datagram_received_number_at block="radio receive number|at %VALUE" blockGap=8 shim=radio::receivedNumberAt
|
2016-04-03 02:34:06 +02:00
|
|
|
function receivedNumberAt(index: number): number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reads the next packet as a number from the radio queue.
|
|
|
|
*/
|
|
|
|
//% help=radio/receive-number
|
|
|
|
//% weight=46
|
2016-08-02 01:02:06 +02:00
|
|
|
//% blockId=radio_datagram_receive block="radio receive number" blockGap=8 shim=radio::receiveNumber
|
2016-04-03 02:34:06 +02:00
|
|
|
function receiveNumber(): number;
|
|
|
|
|
2016-05-12 21:35:40 +02:00
|
|
|
/**
|
|
|
|
* Reads the next packet as a string and returns it.
|
|
|
|
*/
|
2016-08-02 01:02:06 +02:00
|
|
|
//% blockId=radio_datagram_receive_string block="radio receive string" blockGap=8
|
2016-05-12 21:35:40 +02:00
|
|
|
//% weight=44
|
|
|
|
//% help=radio/receive-string shim=radio::receiveString
|
|
|
|
function receiveString(): string;
|
|
|
|
|
2016-04-03 02:34:06 +02:00
|
|
|
/**
|
|
|
|
* Gets the received signal strength indicator (RSSI) from the packet received by ``receive number``. Not supported in simulator.
|
|
|
|
* namespace=radio
|
|
|
|
*/
|
|
|
|
//% help=radio/received-signal-strength
|
|
|
|
//% weight=40
|
2016-08-02 01:02:06 +02:00
|
|
|
//% blockId=radio_datagram_rssi block="radio received signal strength" shim=radio::receivedSignalStrength
|
2016-04-03 02:34:06 +02:00
|
|
|
function receivedSignalStrength(): number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the group id for radio communications. A micro:bit can only listen to one group ID at any time.
|
|
|
|
* @ param id the group id between ``0`` and ``255``, 1 eg
|
|
|
|
*/
|
|
|
|
//% help=radio/set-group
|
2016-08-02 01:02:06 +02:00
|
|
|
//% weight=10 blockGap=8
|
|
|
|
//% blockId=radio_set_group block="radio set group %ID" shim=radio::setGroup
|
2016-04-03 02:34:06 +02:00
|
|
|
function setGroup(id: number): void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Change the output power level of the transmitter to the given value.
|
2016-06-19 14:15:13 +02:00
|
|
|
* @param power a value in the range 0..7, where 0 is the lowest power and 7 is the highest. eg: 7
|
2016-04-03 02:34:06 +02:00
|
|
|
*/
|
|
|
|
//% help=radio/set-transmit-power
|
2016-08-02 01:02:06 +02:00
|
|
|
//% weight=9 blockGap=8
|
|
|
|
//% blockId=radio_set_transmit_power block="radio set transmit power %power" shim=radio::setTransmitPower
|
2016-04-03 02:34:06 +02:00
|
|
|
function setTransmitPower(power: number): void;
|
2016-05-11 06:13:16 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the radio to transmit the serial number in each message.
|
|
|
|
*/
|
|
|
|
//% help=radio/set-transmit-serial-number
|
2016-08-02 01:02:06 +02:00
|
|
|
//% weight=8 blockGap=8
|
|
|
|
//% blockId=radio_set_transmit_serial_number block="radio set transmit serial number %transmit" shim=radio::setTransmitSerialNumber
|
2016-05-11 06:13:16 +02:00
|
|
|
function setTransmitSerialNumber(transmit: boolean): void;
|
2016-04-03 02:34:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Auto-generated. Do not edit. Really.
|