While this particular code works, yours may not the first time, so
the Logs(Debug) Immediate window is a good way to check to see
exactly what is being received by MakerPlot for code debugging
purposes. Now, let’s get to the analog and digital data part.
Capturing Analog and Digital Data
Figure 4 is the listing for the loop part of the sketch that
outputs analog and digital data, along with more instructions to
MakerPlot. Recall from Parts 5 and 6 that this is an interactive
setpoint application and that the analog data consists of the
potentiometer and setpoint values. The digital values consist of
the two pushbutton switches and the above (1) or below (0)
setpoint crossing level. Let’s check out what they look like in the
Logs(Debug) Immediate window.
Beginning with the analog data, Figure 6 illustrates how
MakerPlot receives these two values. To view analog data, the
Anlg and Scroll boxes (red ovals) need to be checked. As you can
see, there are two sets of numbers separated
by a comma. The first is the potentiometer
value (the black plot), followed by the setpoint
value (the red plot). So, as the plotted pot and
setpoint values change, you’ll see these values
change in the Logs(Debug) Immediate
window along with them.
To display digital data, you’ll need to
uncheck Anlg and check the Dig box. The
result is in Figure 7 where the three digital
values are displayed as 1s and 0s preceded by
the percent (%) sign. As the SW1 and SW2
pushbuttons are pressed, the data changes. If
the potentiometer level goes above or below
the analog setpoint, the digital setpoint changes
from 1 to 0, respectively (the right-most
number). This is evident on the top three plot
lines, as well. You can see both the analog and
digital values together by simply checking both the
Anlg and Dig boxes. Figure 8 shows how this looks.
The take-away from all of this is that the Logs(Debug)
Immediate window provides you with a double-check
on what your micro is sending to MakerPlot, in
addition to the regular plotted lines.
Manually Entering Instructions
and Data
Now, let’s go the other way and show you how to
manually enter both instructions and data into
MakerPlot using the Logs(Debug) Immediate window.
This is in contrast to the instructions and data coming
from the micro via the serial link; now they’re going to
come into MakerPlot through the CLI window — the
rectangular text box at the bottom. To do this, you’ll
48 April 2014
Figure 6. Analog data display.
Figure 7. Digital data display.
Figure 8. Mixed analog and digital data display.