Hardware Reference
In-Depth Information
Figure 3-4.
Firmata testing application
The Firmata test app is especially usefully for testing out component setups that use multiple pins, such as a
three- to eight-line MUXs, seven-segment displays , keypads, and servomotors.
Controlling the Arduino with openFrameworks
The code in the next example uses the same
main.cpp
as Listing 3-2. The header file
testapp.h
in Listing 3-5 still
declares the class function prototypes
setup()
,
update()
,
draw()
, and
mousePressed()
. The two new function
prototypes are set up to mimic the Arduino's coding structure. The function
arduinoSetup()
is for initializing pin
configurations, and the function
arduinoLoop()
is the equivalent to
loop
in Arduino sketches.
Listing 3-5.
testapp.h for the Standard Firmata Sketch Communication
#include "ofMain.h"
#include "ofEvents.h"