Figure 2. Where to put the libraries folder.
Figure 1. Where to put it.
created under Applications (Figure 1).
This location is important since there is a
folder under my Arduino folder called libraries. Go
ahead and create this folder as we’ll need it for
the next step. I created a drivers folder for the two
virtual COM port drivers that came with the install.
You need to know where your Arduino install
thinks it is installed. To do this, start Arduino
(double-click on it) and look at your preferences.
On the Mac, this is under the Arduino menu.
When you bring up your preferences, it should
look something like Figure 2. Sketchbook location
is the folder under which you need to create your
libraries folder. I didn’t change anything in my
preferences; I just used what it was set to.
When you unzip this file, there will be a folder
called NewSoftSerial. Drag that folder into the
libraries folder you created previously.
You are now ready to use your Arduino and
its new expansion library NewSoftSerial. I’m not
going to describe how to set up your Arduino
hardware. The Arduino site does that very well
and it is very easy. I am using my own
ATMEGA168 board with an Arduino bootloader
variant on it for my tests.
Using the NewSoftSerial
Find and Install the
Get the NSS library from http://arduiniana.
When you install the NSS library in the
location specified above, you will need to re-start
your Arduino application so that it can find it. To
use this library, all you need to do is import it. To
import a library, just start a new sketch (what
Arduino calls a program). Take a look at Figure 3.
Notice that your file just got a new “#include”
entry. That is all there is to it. Now we can start
programming with NSS.
There isn’t any user documentation
that I’ve found for NSS, so what I
know about the library is what I’ve
seen in the two sample programs
and from reading the source. NSS
appears to only support 8N1 serial and
all of the common baud rates from 50
to 115,200. You can define the Rx,Tx
lines when you define the NSS object
or use the setRx() and set Tx() methods
later on. NSS inherits from the standard
Arduino Print class, so you can print
data using the methods defined in the
Figure 3. Importing a library.
16 SERVO 01.2010