Rewrote one Serial topic; shifted some material

This commit is contained in:
Ron Hale-Evans
2016-07-08 15:29:14 -07:00
parent af91622dda
commit 8751d2aaa1
3 changed files with 30 additions and 17 deletions

View File

@ -1,6 +1,6 @@
# Write Value
Writes name/value pair and a new line character (`\r\n`) to [serial](/device/serial).
Write a name/value pair and a newline character (`\r\n`) to the [serial](/device/serial) port.
```sig
serial.writeValue("x", 0);
@ -8,7 +8,8 @@ serial.writeValue("x", 0);
### Example: streaming data
The sample below sends the temperature and light level every 10 seconds.
Every 10 seconds, the example below sends the temperature and light level
to the serial port.
```blocks
basic.forever(() => {
@ -18,19 +19,17 @@ basic.forever(() => {
})
```
### Plot bar graph does serial!
#### ~hint
If you use the `led.plotBarGraph` function, it automatically writes the value to the serial as well.
```blocks
basic.forever(() => {
led.plotBarGraph(input.lightLevel(), 255)
basic.pause(10000);
})
```
The [send value](/reference/radio/send-value) function broadcasts
string/number pairs. You can use a second micro:bit to receive them,
and then send them directly to the serial port with ``write value``.
#### ~
### See also
[serial](/device/serial), [write line](/reference/serial/write-line)
[serial](/device/serial),
[serial write line](/reference/serial/write-line),
[serial write number](/reference/serial/write-number),
[send value](/reference/radio/send-value)