C:/Documents and Settings/Owner/My Documents/My Code/NXT++/files/include/NXT++.h File Reference

#include "comm.h"
#include <time.h>
#include <math.h>
#include <string>
#include <iostream>
#include <vector>

Include dependency graph for NXT++.h:

Go to the source code of this file.

Namespaces

namespace  NXT
namespace  NXT::Motor
namespace  NXT::Sensor
namespace  NXT::File
namespace  NXT::Module
namespace  NXT::NxtCam

Enumerations

enum  SensorType {
  Touch, Sound, Light, ActiveLight,
  Sonar
}
 Defines different types of sensors. More...
enum  NXT::File::FileType {
  NXT::File::ANY, NXT::File::PROGRAM, NXT::File::SOUND, NXT::File::GRAPHICS,
  NXT::File::DATALOG
}
 Defines different types of resource files. More...
enum  NXT::File::FileMode {
  NXT::File::READ, NXT::File::WRITE, NXT::File::APPEND, NXT::File::DATA_WRITE,
  NXT::File::LINEAR_WRITE
}
 Defines different types of file modes. More...

Functions

bool NXT::Open (Comm::NXTComm *comm)
 Initiates the NXT connection.
bool NXT::OpenBT (Comm::NXTComm *comm)
 Initiates the NXT connection through Bluetooth.
void NXT::Close (Comm::NXTComm *comm)
 Closes the NXT connection.
void NXT::PlayTone (Comm::NXTComm *comm, int frequency, int duration)
 Plays a tone.
int NXT::BatteryLevel (Comm::NXTComm *comm)
 Returns the current battery level.
std::string NXT::GetName (Comm::NXTComm *comm)
 Gets the name of the NXT.
double NXT::GetAvailableFlash (Comm::NXTComm *comm)
 Gets the amount of availiable flash memory on the NXT.
void NXT::StopProgram (Comm::NXTComm *comm)
 Stops the current program if one is running.
double NXT::GetProtocolVersion (Comm::NXTComm *comm)
 Gets the protocol version of the NXT.
double NXT::GetFirmwareVersion (Comm::NXTComm *comm)
 Gets the firmware version of the NXT.
void NXT::StartProgram (Comm::NXTComm *comm, std::string name)
 Starts a program on the NXT with a specified name.
void NXT::PlaySoundFile (Comm::NXTComm *comm, std::string name, bool loop)
 Plays a sound file on the NXT with a specified name.
void NXT::StopSound (Comm::NXTComm *comm)
 Stops the currently playing sound.
void NXT::KeepAlive (Comm::NXTComm *comm)
 Resets the internal sleep timer.
void NXT::SendDirectCommand (Comm::NXTComm *comm, ViBoolean response, ViByte *dc_buf, int dc_buf_size, ViByte *re_buf, int re_buf_size)
 Sends a direct command to the NXT.
int NXT::Motor::GetRotationCount (Comm::NXTComm *comm, int port)
 Returns the rotation of a motor.
void NXT::Motor::ResetRotationCount (Comm::NXTComm *comm, int port, bool relative)
 Resets the specified motor's rotation count.
void NXT::Motor::SetForward (Comm::NXTComm *comm, int port, int power)
 Sets a motor to turn forward at a specified power.
void NXT::Motor::SetReverse (Comm::NXTComm *comm, int port, int power)
 Sets a motor to turn backward at a specified power.
void NXT::Motor::Stop (Comm::NXTComm *comm, int port, bool brake)
 Tells a motor to stop turning.
void NXT::Motor::BrakeOn (Comm::NXTComm *comm, int port)
 Tells a motor to turn the brake on.
void NXT::Motor::BrakeOff (Comm::NXTComm *comm, int port)
 Tells a motor to turn the brake off.
void NXT::Motor::GoTo (Comm::NXTComm *comm, int port, int power, int tacho, bool brake)
 Tells a motor to go to a certian angle and then stop.
void NXT::Sensor::SetTouch (Comm::NXTComm *comm, int port)
 Sets a sensor in a specified port to a touch sensor.
void NXT::Sensor::SetSound (Comm::NXTComm *comm, int port)
 Sets a sensor in a specified port to a sound sensor.
void NXT::Sensor::SetLight (Comm::NXTComm *comm, int port, bool active)
 Sets a sensor in a specified port to a light sensor.
void NXT::Sensor::SetSonar (Comm::NXTComm *comm, int port)
 Sets a sensor in a specified port to a sonar sensor.
void NXT::Sensor::SetCmpsNx (Comm::NXTComm *comm, int port)
 Sets a sensor in a specified port to a Mind Sensors Compass sensor.
void NXT::Sensor::SetDistNx (Comm::NXTComm *comm, int port)
 Sets a sensor in a specified port to a Mind Sensors Distance sensor.
void NXT::Sensor::SetRaw (Comm::NXTComm *comm, int port)
 Sets a sensor to return a raw value (not formatted in any way).
void NXT::Sensor::Set (Comm::NXTComm *comm, int port, SensorType type)
 Sets a sensor to a specified SensorType.
int NXT::Sensor::GetValue (Comm::NXTComm *comm, int port)
 Retrieves the value of a sensor.
int NXT::Sensor::GetAvgCmpsNxValue (Comm::NXTComm *comm, int port, int numValues, int waitTime)
 Retrieves multiple values of the Mindsensors Compass sensor and averages them.
int NXT::Sensor::GetCmpsNxValue (Comm::NXTComm *comm, int port)
 Retrieves the value of the Mindsensors Compass sensor.
int NXT::Sensor::GetDistNxValue (Comm::NXTComm *comm, int port)
 Retrieves the value of the Mindsensors Distance sensor.
int NXT::Sensor::GetCleanDistNxValue (Comm::NXTComm *comm, int port)
 Retrieves multiple values of the Mindsensors Distance sensor and averages them.
int NXT::Sensor::LSGetStatus (Comm::NXTComm *comm, int port)
 Gets the status of the lowspeed port.
int NXT::Sensor::GetSonarValue (Comm::NXTComm *comm, int port)
 Retrieves the value for sonar sensors.
void NXT::Sensor::SetSonarOff (Comm::NXTComm *comm, int port)
 Tells the sonar sensor to stop sending pulses.
void NXT::Sensor::SetSonarSingleShot (Comm::NXTComm *comm, int port)
 Tells the sonar sensor to only send a pulse when you ask it what it's value is.
void NXT::Sensor::SetSonarContinuous (Comm::NXTComm *comm, int port)
 Tells the sonar sensor to continuously send pulses.
void NXT::Sensor::SetSonarContinuousInterval (Comm::NXTComm *comm, int port, int interval)
 Sets the interval at which the sonar sensor sends a pulse.
void NXT::Sensor::writeI2C (Comm::NXTComm *comm, int port, ViUInt8 command[], int replySz, int tx_length)
 Writes the command to the I2C sensor.
ViUInt8 * NXT::Sensor::readI2C (Comm::NXTComm *comm, int port)
 Reads the values from the registers of an I2C sensor.
int NXT::File::getNXTFile (Comm::NXTComm *comm, std::string filename, NXTFile &file)
 Retrieves a specific NXT file pointer by name.
int NXT::File::getNXTFilesByName (Comm::NXTComm *comm, std::string pattern, NXTFileIterator &iter)
 Retrieves NXT file pointers by name.
int NXT::File::getNXTFilesByType (Comm::NXTComm *comm, int fileType, NXTFileIterator &iter)
 Retrieves NXT file pointers by type.
void NXT::File::destroyFileIterator (Comm::NXTComm *comm, NXTFileIterator &iter)
 Destroys a file iterator.
void NXT::File::destroyFile (Comm::NXTComm *comm, NXTFile &file)
 Destroys a file pointer.
int NXT::Module::getNXTModules (Comm::NXTComm *comm, std::string pattern, NXTModuleIterator &iter)
 Retrieves NXT module pointers by name.
int NXT::Module::getNXTModule (Comm::NXTComm *comm, std::string pattern, int moduleID, int moduleSize, int ioMapSize, int &status, NXTModule &module)
 Retrieves a specific module pointer by name.
void NXT::NxtCam::NxtCamFlush (Comm::NXTComm *comm, int port)
void NXT::NxtCam::NxtCamCmd (Comm::NXTComm *comm, int port, ViUInt8 command[], int tx_length)
void NXT::NxtCam::NxtCamInit (Comm::NXTComm *comm, int port)
void Wait (int time)
 Waits a specified time.

Variables

const int OUT_A = 0
 Motor port A on the NXT.
const int OUT_B = 1
 Motor port B on the NXT.
const int OUT_C = 2
 Motor port C on the NXT.
const int IN_1 = 0
 Sensor port 1 on the NXT.
const int IN_2 = 1
 Sensor port 2 on the NXT.
const int IN_3 = 2
 Sensor port 3 on the NXT.
const int IN_4 = 3
 Sensor port 4 on the NXT.


Enumeration Type Documentation

enum SensorType

Defines different types of sensors.

Enumerator:
Touch  A touch sensor. GetValue() returns a boolean.
Sound  A sound sensor. GetValue() returns a decibel value.
Light  A light sensor with the infrared light off. GetValue() returns a percent.
ActiveLight  A light sensor with the infrared light on. GetValue() returns a percent.
Sonar  An ultrasonic sensor. GetValue() returns a distance in centimeters.

Definition at line 24 of file NXT++.h.


Function Documentation

void Wait ( int  time  ) 

Waits a specified time.

Parameters:
time The time to wait in milliseconds.


Variable Documentation

const int IN_1 = 0

Sensor port 1 on the NXT.

Definition at line 40 of file NXT++.h.

const int IN_2 = 1

Sensor port 2 on the NXT.

Definition at line 42 of file NXT++.h.

const int IN_3 = 2

Sensor port 3 on the NXT.

Definition at line 44 of file NXT++.h.

const int IN_4 = 3

Sensor port 4 on the NXT.

Definition at line 46 of file NXT++.h.

const int OUT_A = 0

Motor port A on the NXT.

Definition at line 34 of file NXT++.h.

const int OUT_B = 1

Motor port B on the NXT.

Definition at line 36 of file NXT++.h.

const int OUT_C = 2

Motor port C on the NXT.

Definition at line 38 of file NXT++.h.

SourceForge.net Logo