Use the Time Plot visualizer to send measurements from your Arduino to MegunoLink for plotting. Time, for the x-axis, can either be supplied by MegunoLink as it receives your data, or included in the message sent from the Arduino (from a real-time clock, for example).
Time plots are useful for testing new sensors such as accelerometers, temperature, force and many more. Just read the sensor, send the data to MegunoLink using functions from the TimePlot library and it will appear on screen. You can zoom, edit series styles, auto-scroll and export data to the clipboard or a file.
Creating a Time Plot Visualizer
Select Time Plot from the visualizer menu or toolbox to add a new time plot visualizer window to your MegunoLink project. You can add as many plot windows as you like. Use message channels in your Arduino sketch to control the data show on each plot.
Drag the visualizer tab to organize the windows in your MegunoLink project.
Time plot visualizer controls can also be added to interface panels.
Plot properties and series styles can be set using buttons on the plot toolbar. Along with tools to select and remove series, zoom and pan, you can also hide or show the plot legend and toggle visibility of the summary table.
The summary table lists the series which have been detected along with useful statistics including the minimum, maximum and average value received for each series.
Turn on auto-scrolling mode to automatically update the x-axis to show the latest data. Old data will scroll off the left edge of the plot. Data out of view is not lost; simply use the zoom tools to change your view of the data received.
Use the tools on the visualizer toolbar to change the content and appearance of the time-plot.
|Connect/disconnect the selected connection. Use the drop-down to select the connection used by this visualizer.|
|Select the channels processed by the visualizer.|
|Open the plot properties editor to change axis labels and ranges.|
|Show/hide the series summary table.|
|Show/hide the series legend.|
|Enable/disable auto-scroll mode.|
|Open the series property editor for the selected series to change line and marker styles and the axis the series is linked to.|
|Delete all of the series from the plot.|
|Delete the selected series from the plot.|
|Selection tool. Select this tool to pick a series from the plot for editing or deleting.|
|Zoom tool. Select this tool to pick a rectangle on the plot to zoom into. Use the drop-down menu to limit zooming to a horizontal or vertical region, or select a specific time range for the x-axis.|
|Pan tool. Select this tool to drag the view of data plotted. Use the drop-down menu to limit dragging to horizontal or vertical panning.|
|Zoom all. Change the plot axis limits to show all the data.|
|Zoom back. Return to the previous settings of the plot axis limits.|
|Export the series data to an external file.|
|Export the series data to the clipboard so you can paste it into another program, such as Microsoft Excel.|
|Import series data from a text file into the plot.|
|Open online documentation for the visualizer.|
Sending Data from an Arduino
We’ve created a library for Arduino to make it easier to send data to MegunoLink for plotting. After you install the Arduino library,
#include "MegunoLink.h"to the top of your Arduino program
- Create a
SendDatato send data to MegunoLink Pro for plotting
Refer to the Arduino time plot library reference for details on all the methods available.
This simple example sets the graph titles and sends a the current value from analog channel 0 to MegunoLink.
#include "MegunoLink.h" // Helpful functions for communicating with MegunoLink.
// Millis value when the data was last sent.
// Interval (milliseconds) between sending analog data
const unsigned SendInterval = 200; // [ms]
// The plot we are sending data to.
LastSent = millis();
MyPlot.SetTitle("My Analog Measurement");
MyPlot.SetSeriesProperties("ADCValue", Plot::Magenta, Plot::Solid, 2, Plot::Square);
if ((millis() - LastSent) > SendInterval)
LastSent = millis();
int DataValue = analogRead(0);