Analog Data is data that starts with a numeric value. It can be a single value or up to 99 comma-separated values. To ease in sending an alpha-numeric data as well, only the first comma-separated value needs to be numeric. A data string, like all types of data, must end in a carriage return or line feed (ASCII 13 or 10). Note, it is possible to change the delimiter.
Using the Debug/CLI Window (F4) is a great way to test incoming data with your interface or testing features.
10
10,20,30 10,20,30,ON
Reading Analog Values
As analog data arrives it is parsed into MakerPlot Values ain0 to ain99, even alpha-numeric if sent. The values can be accessed by reading them as MPJ values by enclosing them in brackets, [ ], such as printing their values to the Debug/CLI Window.
? [ain0] ? [ain0], [ain1] ? The first value is [ain0]
They may also be accessed from a serial control, such as: ? [serial.ain0]
An analog value which has not been assigned data, such as [ain50], will return a question mark, ?.
The entire analog string may be accessed using [analogString].
? [analogString]
Plotting Analog Values
The Analog Plot Control will automatically accept analog data and plot up to 10 as analog plots. With the Analog Plot Control, Standard Math or Post-Fix Math operations can be performed on incoming data prior to plotting, please see the Analog Plot Control.
Automatically Updating Controls
Controls can have their Update Values configured to automatically update properties based on the analog values. Please see Update Values for more information.
Analog Data Events
Certain controls can have their Event Code triggered on incoming analog data for specialized event processing, such as an Interface, analog plot control and canvas controls. Event code written for these control will be triggered on reception of analog data.
<analog>!if [ain0] > 100 !then !bell // sound computer's bell if ain0 is greater than 100
See Control Events for more information on writing even code.
|