Data Sheet
Core Spartan Documentation Modern Robotics, Inc
Version 3.0.3 Page 17
5.2. Include Statements
The include statement is a key function used to import other pieces of code into the current
file. For our use we include the CORE.h header file which includes all basic Core Spartan
Controller functions and sensor libraries. When including CORE.h into your code double
quotes (“”) must be used and not the angled brackets (<>).
#include “CORE.h”
5.3. Object Declarations
The Object Declaration is a key step to using any of the Modern Robotics hardware. An
object is an instance of a class which contains the blueprints for how a piece of code will
work. When declaring an object, there are three main parts: the constructor, the name and
the parameters.
Constructor name(parameter);
The Constructor is a special function in a class that is called to create an object. Below is a
list of constructors that will be used with the Core Spartan Controller.
CORE_SPARTAN
CORE_INT_GYRO
CORE_SEEKERV3
CORE_PCB
CORE_RANGE
CORE_COLOR_SENSOR
CORE_DIGITAL
CORE_COMPASS
CORE_COLOR_BEACON
CORE_ANALOG
CORE_LOCATOR
CORE_I2C
CORE_SOUND
The name of the object declaration is completely arbitrary and very important. The name is
used later in code when a function is being used from the class that the object was created.
Below is an example of using the name to call motor functions. More detail on motor
functions can be found later in this document (section 5.3).
CORE_SPARTAN myname;
…
myname.motorMode(myname.M0, myname.BRAKE);
myname.motorSpeed(myname.M0, 50);
In this example motorMode and motorSpeed are class functions. Both M0 and BRAKE are
class constants. They all must have the name “myname.” before and function or variable
from the class can be used.










