pxt-calliope/docs/streaming.md

32 lines
1.4 KiB
Markdown
Raw Normal View History

2016-06-24 08:22:46 +02:00
# Streaming
2016-11-02 01:44:37 +01:00
This page describes how to stream data from the @boardname@ to the editor or even to the cloud.
2016-06-24 08:22:46 +02:00
## Before starting...
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
## A typical scenario
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.
## Local download
The log view will automatically start to collect and organize the data it detects. Simply click on the log view to open the various options
to export the data. The simplest option is to download the data as a **CSV file**. This file can easily be opened in programs like Office Excel.
2016-06-25 01:37:05 +02:00
## Cloud upload via Azure
2016-06-24 08:22:46 +02:00
2016-06-25 01:37:05 +02:00
In the data export dialog, there is another option to upload the data to the Azure cloud. This allows to upload small amounts of data
2016-06-24 08:22:46 +02:00
without any kind setup. The data can be accessed via web services or directly from Office Excel.