// Check states of pushbuttons, if
// pressed change setpoint up or down
SW1state = digitalRead(SW1pin);
// get SW1 state
if (SW1state == 0)
// test for SW1 depressed
// increment setPoint by 1
Serial.print (“!O Slider =”);
// send to Makerplot to adjust
// based on new setPoint
Figure 5. Bi-directional control using slider
and pushbutton switches.
The code is pretty straightforward:
• Read the switches (SW1 then SW2).
• See if either are depressed.
• If so, increment (SW1) or decrement
(SW2) the SetPoint variable.
• Send the new setpoint to MakerPlot via
the “!O Slider = SetPoint” command.
This part of the code satisfies Steps 4 and 5
in Figure 1. What follows is just sending the pot
value along with the pushbutton switch settings
to MakerPlot for plotting. Then, there’s the 100
millisecond delay and everything repeats.
Figure 5 is just one screenshot of what it
Behind the Scenes
Figure 6. Behind the scenes with the
Logs (Debug) Immediate window.
Now that you’ve been shown how to code
the Arduino to allow MakerPlot to monitor and
control the setpoint, there’s another MakerPlot feature we
want to introduce you to: the Logs(Debug) Immediate
window. The Logs(Debug) Immediate window can display
a complete record of all data and other activities in
You can bring up the Logs(Debug) Immediate
window by clicking on the Logbook icon on the toolbar.
MakerPlot. It is the primary MakerPlot debug tool!
It’s shown in Figure 6 where it’s displaying the last part of
the setpoint adjustment. Here, you can see not only the
analog and digital data coming in from the Arduino, but
March 2014 51