Radiodocsupdate (#1430)
* a few updates * more updates * reorder radio blocks * more shuffling of new radio apis * fixing hot or ocold * more doc fixes * more updates * fixing docs issues * more doc fixes * restore docs errors * missing packate * renamed argument of callback * mssing radio * more odcs fixes * lock turtle * ignore docs for now
This commit is contained in:
@ -89,7 +89,7 @@ basic.forever(() => {
|
||||
|
||||
This receiver @boardname@ uses the “on start” event to set up the title on the @boardname@ when started, the radio group, and the ``bodyElectricity`` variable to collect and store the data received.
|
||||
|
||||
The ``||radio:on radio received||`` event reads the number value sent from the sending @boardname@. The number is then stored in the ``bodyElectricity`` variable. the electricity on pin **0** and stores it in the variable ``bodyElectricity``. The last line uses the serial write command to send the text `"Body Electricity"` label and the value of ``bodyElectricity`` variable back to the Windows 10 MakeCode app. The data is sampled and send from 10 to 20 times per second.
|
||||
The ``||radio:on received number||`` event reads the number value sent from the sending @boardname@. The number is then stored in the ``bodyElectricity`` variable. the electricity on pin **0** and stores it in the variable ``bodyElectricity``. The last line uses the serial write command to send the text `"Body Electricity"` label and the value of ``bodyElectricity`` variable back to the Windows 10 MakeCode app. The data is sampled and send from 10 to 20 times per second.
|
||||
|
||||
```blocks
|
||||
// Body Electricity Receiver
|
||||
@ -98,7 +98,7 @@ let bodyElectricty = 0
|
||||
radio.setGroup(99)
|
||||
|
||||
// Radio Receiver event
|
||||
radio.onDataPacketReceived( ({ receivedNumber }) => {
|
||||
radio.onReceivedNumber(function (receivedNumber) {
|
||||
bodyElectricty = receivedNumber
|
||||
serial.writeValue("Body Electricty", bodyElectricty)
|
||||
})
|
||||
|
@ -85,7 +85,7 @@ In the radio received event, the temperature is received from sending the micro:
|
||||
let temperature = 0
|
||||
radio.setGroup(99)
|
||||
basic.showString("TEMPERATURE RECEIVER")
|
||||
radio.onDataPacketReceived( ({ receivedNumber }) => {
|
||||
radio.onReceivedNumber(function (receivedNumber) {
|
||||
basic.showNumber(receivedNumber)
|
||||
})
|
||||
```
|
||||
@ -99,7 +99,7 @@ This code is the same as above but one additional line of code is added to write
|
||||
let temperature = 0
|
||||
basic.showString("TEMPERATURE RECEIVER SERIAL")
|
||||
radio.setGroup(99)
|
||||
radio.onDataPacketReceived( ({ receivedNumber }) => {
|
||||
radio.onReceivedNumber(function (receivedNumber) {
|
||||
basic.showNumber(receivedNumber)
|
||||
serial.writeValue("Celisus", receivedNumber)
|
||||
})
|
||||
@ -143,14 +143,14 @@ basic.showString("GRAVITY RECEIVER")
|
||||
radio.setGroup(99)
|
||||
```
|
||||
|
||||
The ``||radio:on radio received||`` event will constantly monitor radio signals from the radio group.
|
||||
The ``||radio:on received number||`` event will constantly monitor radio signals from the radio group.
|
||||
When a value is received from the group it is stored in the ``gravity`` variable.
|
||||
The ``||serial:serial write value||`` sends 2 pieces of data back to the MakeCode app through the USB cable. First it sends a label `"gravity"` and then the value received as gravity from the ``||input:acceleration||`` method from the first micro:bit.
|
||||
|
||||
```blocks
|
||||
basic.showString("GRAVITY RECEIVER")
|
||||
radio.setGroup(99)
|
||||
radio.onDataPacketReceived( ({ receivedNumber }) => {
|
||||
radio.onReceivedNumber(function (receivedNumber) {
|
||||
serial.writeValue("gravity", receivedNumber)
|
||||
})
|
||||
```
|
||||
|
@ -52,7 +52,7 @@ radio.setGroup(99)
|
||||
|
||||
#### Code the receive event
|
||||
|
||||
7. The ``||radio:on radio received||`` event will constantly monitor radio signals from the radio group.
|
||||
7. The ``||radio:on received number||`` event will constantly monitor radio signals from the radio group.
|
||||
8. When a value is received from the group it is stored in the ``gravity`` variable.
|
||||
9. The ``||serial:serial write Value||`` sends 2 pieces of data back to the MakeCode app through the USB cable. First it sends a label `"gravity"` and then the value received as gravity from the acceleration method from the first @boardname@.
|
||||
10. Add a ``||led:toggle||`` to indicate that it's receiving data. Change ``x`` to `1` so that another LED blinks.
|
||||
@ -60,8 +60,8 @@ radio.setGroup(99)
|
||||
```blocks
|
||||
basic.showString("GRAVITY RECEIVER")
|
||||
radio.setGroup(99)
|
||||
radio.onDataPacketReceived( ({ receivedNumber: gravity }) => {
|
||||
serial.writeValue("gravity", gravity)
|
||||
radio.onReceivedNumber(function (receivedNumber) {
|
||||
serial.writeValue("gravity", receivedNumber)
|
||||
led.toggle(1, 0)
|
||||
})
|
||||
```
|
||||
|
@ -71,11 +71,11 @@ radio.setGroup(10)
|
||||
serial.writeLine("Acceleration")
|
||||
```
|
||||
|
||||
The ``||radio:on radio received||`` event reads the number value from the sending @boardname@. The number is then stored in the variable ``receivedNumber``. The last line uses the serial write command to send the text ``"z"`` label and the value of ``receivedNumber`` variable back to the Windows 10 MakeCode app. The data is sampled and send from 10 to 20 times per second.
|
||||
The ``||radio:on received number||`` event reads the number value from the sending @boardname@. The number is then stored in the variable ``receivedNumber``. The last line uses the serial write command to send the text ``"z"`` label and the value of ``receivedNumber`` variable back to the Windows 10 MakeCode app. The data is sampled and send from 10 to 20 times per second.
|
||||
|
||||
```blocks
|
||||
// onRadio receive & write z value to serial
|
||||
radio.onDataPacketReceived(({ receivedNumber }) => {
|
||||
radio.onReceivedNumber(function (receivedNumber) {
|
||||
serial.writeValue("z", receivedNumber)
|
||||
})
|
||||
```
|
||||
|
@ -102,14 +102,14 @@ basic.forever(() => {
|
||||
|
||||
In the starting of the code the title is displayed, radio group `99` is setup, and the initial ``temperature`` variable is set to `0`.
|
||||
|
||||
In the ``||radio:on radio received||`` event, the temperature is received from sending the @boardname@ radio. The receive temperature is then displayed on the LED display. This is repeated whenever a radio signal is received.
|
||||
In the ``||radio:on received number||`` event, the temperature is received from sending the @boardname@ radio. The receive temperature is then displayed on the LED display. This is repeated whenever a radio signal is received.
|
||||
|
||||
```blocks
|
||||
let temperature = 0
|
||||
basic.showString("TEMPERATURE RADIO RECEIVER")
|
||||
radio.setGroup(99)
|
||||
radio.onDataPacketReceived( ({ receivedNumber: temperature }) => {
|
||||
basic.showNumber(temperature)
|
||||
radio.onReceivedNumber( function(receivedNumber) {
|
||||
basic.showNumber(receivedNumber)
|
||||
})
|
||||
```
|
||||
|
||||
@ -121,9 +121,9 @@ This code is the same as above but one additional line of code is added to write
|
||||
let temperature = 0
|
||||
basic.showString("TEMPERATURE RADIO RECEIVER SERIAL")
|
||||
radio.setGroup(99)
|
||||
radio.onDataPacketReceived( ({ receivedNumber: temperature }) => {
|
||||
basic.showNumber(temperature)
|
||||
serial.writeValue("Celisus", temperature)
|
||||
radio.onReceivedNumber( function(receivedNumber) {
|
||||
basic.showNumber(receivedNumber)
|
||||
serial.writeValue("Celisus", receivedNumber)
|
||||
})
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user