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 styles, auto-scroll and export data to the clipboard or a file.
To create a new time plot, select the time-plot visualizer from the Visualizers panel. Click the Visualize icon on the main toolbar to show the Visualizers panel.
The chart will automatically scroll to show the latest data when auto-scroll, on the visualizer’s tool-bar, is turned on.
Check out this instructable for a step-by-step guide to using plotting with MegunoLink Pro.
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
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);
MegunoLink Pro plots support channels, a short text string for grouping series together. Channels let you have several plots in a project, sending different data to each.
Refer to the Arduino Library documentation and the message format reference for more information on setting up channels in your microcontroller.
Use the channel selector on the plot toolbar to choose which channel the plot should show. The channel selector is automatically populated with channels as they are detected.
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.