// white
red = 255;
green = 255;
blue = 255;
pixel.setColor(red, green, blue, brightness);
delay(500);
}
</>
!
SOFTWARE LIBRARIES
To avoid having to reinvent the wheel with every
program, there are
software libraries. These are not
book collections. Instead, they contain reusable
program functions and definitions. There are some
libraries that provide mathematical functions, while
there are others to make it easy to use certain types of
hardware such as sensors or NeoPixels. To be able to use
the tools that this kind of library can make available to
you, you have to
include the corresponding library in
your own program.
You do this with the help of the
#include
instruction:
#include <KosmoBits_Pixel.h>
includes the
KosmoBits_Pixel library, for example. Some libraries,
however, use functions from other libraries. They have to
be additionally included, such as in the KosmoBits_Pixel
library. More specifically, in order to work they require
the Adafruit_NeoPixel library, which is linked via
#include <Adafruit_NeoPixel.h>
.
▲
Another type of library
20
PROJECT 4
CodeGamer manual inside english.indd 20
7/19/16 12:32 PM