pxt-calliope/docs/streaming.md

21 lines
756 B
Markdown
Raw Normal View History

2017-03-16 22:35:10 +01:00
# @extends
2016-06-24 08:22:46 +02:00
2017-03-16 22:35:10 +01:00
## Before starting... #setup
2016-06-24 08:22:46 +02:00
2016-11-02 01:44:37 +01:00
Make sure you follow the instructions on [how to setup a serial connection](/device/serial) with the @boardname@.
2016-06-24 08:22:46 +02:00
2017-03-16 22:35:10 +01:00
## A typical scenario #example
2016-06-24 08:22:46 +02:00
A common scenario is to chart some sensor data, such as the acceleration, and analyse it in the editor.
2016-11-02 01:44:37 +01:00
For example, run this code on your @boardname@.
2016-06-24 08:22:46 +02:00
```blocks
basic.forever(() => {
led.plotBarGraph(input.acceleration(Dimension.X), 0);
});
```
2016-11-02 01:44:37 +01:00
If your serial connection is working, you will start to see a chart representing that acceleration ``x`` value read from the @boardname@.
2016-06-24 08:22:46 +02:00
Each time ``led.plotBarGraph`` is called, the value is also written to the serial output. The log view automatically detects
that there is a data stream and displays a graph.