Hardware Reference
In-Depth Information
Chapter 3
openFrameworks and Arduino
openFrameworks is a set of C++ libraries that provides an easy method of coding audio, video, and graphical
components. openFrameworks provides mechanisms to easily connect serial devices and Arduinos to personal
computers, making openFrameworks an invaluable tool for Arduino development and a useful next topic for
discussion.
openFrameworks can be compared to interlocking plastic construction bricks in that using individual units does
not require knowing how to make them. The libraries of openFrameworks are a lot like boxes of construction bricks,
allowing creativity to flow without having to code from the ground up and always having a piece that will work. This is
done by utilizing C++ object-oriented programming methods, which add abstraction and reusability. The advantage
to openFrameworks in a development scene is that you can put together proofs of concept without having to do a
lot of low-level coding. Working in openFrameworks also provides working code that can be used as a blueprint to
migrate from when a final project goes into production and needs more optimizations.
Incorporating both openFrameworks and Arduino helps create a proof-of-concept environment for hardware
and software interaction, which uses a development approach that “work fosters ideas”; an exploratory development
style where ideas can be explored without waste. The key to this is reusability: not having to worry about permanently
using a resource and having plenty components to play with. The combination of openFrameworks and Arduino is
cross compatible on most systems.
The disadvantages to this setup are that it may not be production quality, optimized, reliable, or usable for the
masses; things that are arguably less important than sharing and exploration in idea generation. The disadvantages
are taken care of when moving away from the proof of concept to a prototype or putting the project into production.
For developers, showing an idea is more impressive when that idea is something that can be fully manipulated.
Physical models go a long way toward helping ideas to take life and can be easily created with clay, wood, 3D printing,
or various other means. Adding openFrameworks and Arduinos to a physical model can, for example, help you create
a new game controller design that can be used to play games.
Arduino and openFrameworks comprise a nice tool set to help breathe that extra life into an idea. With its simple
code structure, designers, artists, it gives developers the ability to add buttons to make LEDs blink, create controllers
to move virtual objects, and make systems that manipulate physical objects. Both Arduino and openFrameworks have
vast online communities and a plethora of other documentation, making the knowledge to work and develop with
these systems easily available. This chapter focuses on connecting the Arduino to computers via openFrameworks to
expand the functionality of the Arduino.
Getting Started
To get started, make sure that the openFrameworks and Arduino software are set up and working, and also make
sure there is a compatible Arduino board (e.g., an Uno, Leonardo or Nano) available. To download and install
openFrameworks, go to www.openframeworks.cc and follow the setup instructions for your system. openFrameworks
requires C++ and is built for integrated development environments (IDEs) such as Code::Blocks ( www.codeblocks.org ),
Visual C++ ( www.microsoft.com/express ), and Xcode ( http://developer.apple.com/xcode/ ) .
 
Search WWH ::




Custom Search