Mindstorms 3rd Party ROBOTC Drivers RobotC
[Home] [Download] [Submit a bug/suggestion] [ROBOTC Forums] [Blog] [Support this project]
Files | Defines | Functions | Variables

Light Sensor
[Lego]

Files

file  lego-light.h
 

Lego Light Sensor driver.


Defines

#define LEGOLSDAT   "legols.dat"

Functions

int LSvalRaw (tSensors link)
int LSvalNorm (tSensors link)
void LScalLow (tSensors link)
void LScalHigh (tSensors link)
void LSsetActive (tSensors link)
void LSsetInactive (tSensors link)
int LSvalNorm (tMUXSensor muxsensor)
void LScalLow (tMUXSensor muxsensor)
int LSvalRaw (tMUXSensor muxsensor)
void LScalHigh (tMUXSensor muxsensor)
void LSsetActive (tMUXSensor muxsensor)
void LSsetInactive (tMUXSensor muxsensor)
void _LScheckSensor (tSensors link)
void _LSwriteCalVals ()
void _LSreadCalVals ()

Variables

int lslow [16]
int lshigh [16]
bool legols_calibrated = false

Detailed Description

Light Sensor


Define Documentation

#define LEGOLSDAT   "legols.dat"

Datafile for Light Sensor calibration info

Definition at line 42 of file lego-light.h.


Function Documentation

void _LScheckSensor ( tSensors  link )

Check if the sensor is set to raw and that it's been configured as a LightActive or Inactive sensor. If not, set the default to sensorLightInActive.

Note: this is an internal function and should not be called directly

Parameters:
linkthe Light Sensor port number

Definition at line 245 of file lego-light.h.

void _LSreadCalVals (  )

Read the low and high calibration values from a data file.

Note: this is an internal function and should not be called directly

Definition at line 322 of file lego-light.h.

void _LSwriteCalVals (  )

Write the low and high calibration values to a data file.

Note: this is an internal function and should not be called directly

Definition at line 259 of file lego-light.h.

void LScalHigh ( tMUXSensor  muxsensor )

Calibrate the Light Sensor's high calibration value with the current raw sensor reading.

Parameters:
muxsensorthe SMUX sensor port number

Definition at line 187 of file lego-light.h.

void LScalHigh ( tSensors  link )

Calibrate the Light Sensor's high calibration value with the current raw sensor reading.

Parameters:
linkthe Light Sensor port number
Examples:
lego-light-SMUX-test2.c, and lego-light-test2.c.

Definition at line 174 of file lego-light.h.

void LScalLow ( tMUXSensor  muxsensor )

Calibrate the Light Sensor's low calibration value with the current raw sensor reading.

Parameters:
muxsensorthe SMUX sensor port number

Definition at line 163 of file lego-light.h.

void LScalLow ( tSensors  link )

Calibrate the Light Sensor's low calibration value with the current raw sensor reading.

Parameters:
linkthe Light Sensor port number
Examples:
lego-light-SMUX-test2.c, and lego-light-test2.c.

Definition at line 150 of file lego-light.h.

void LSsetActive ( tSensors  link )

Configure the sensor as a LightActive sensor

Parameters:
linkthe Light Sensor port number
Examples:
lego-light-SMUX-test1.c, lego-light-SMUX-test2.c, lego-light-test1.c, and lego-light-test2.c.

Definition at line 198 of file lego-light.h.

void LSsetActive ( tMUXSensor  muxsensor )

Configure the sensor as a LightActive sensor

Parameters:
muxsensorthe SMUX sensor port number

Definition at line 210 of file lego-light.h.

void LSsetInactive ( tMUXSensor  muxsensor )

Configure the sensor as a LightInactive sensor

Parameters:
muxsensorthe SMUX sensor port number

Definition at line 232 of file lego-light.h.

void LSsetInactive ( tSensors  link )

Configure the sensor as a LightInactive sensor

Parameters:
linkthe Light Sensor port number
Examples:
lego-light-SMUX-test1.c, and lego-light-test1.c.

Definition at line 220 of file lego-light.h.

int LSvalNorm ( tMUXSensor  muxsensor )

Read the normalised value of the Light Sensor, based on the low and high values.

Parameters:
muxsensorthe SMUX sensor port number
Returns:
the normalised value

Definition at line 128 of file lego-light.h.

int LSvalNorm ( tSensors  link )

Read the normalised value of the Light Sensor, based on the low and high values.

Parameters:
linkthe Light Sensor port number
Returns:
the normalised value
Examples:
lego-light-SMUX-test1.c, lego-light-SMUX-test2.c, lego-light-test1.c, and lego-light-test2.c.

Definition at line 102 of file lego-light.h.

int LSvalRaw ( tSensors  link )

Read the raw value of the Light Sensor.

Parameters:
linkthe Light Sensor port number
Returns:
the raw value of the Light Sensor
Examples:
lego-light-SMUX-test1.c, lego-light-SMUX-test2.c, lego-light-test1.c, and lego-light-test2.c.

Definition at line 79 of file lego-light.h.

int LSvalRaw ( tMUXSensor  muxsensor )

Read the raw value of the Light Sensor.

Parameters:
muxsensorthe SMUX sensor port number
Returns:
the raw value of the Light Sensor

Definition at line 92 of file lego-light.h.


Variable Documentation

bool legols_calibrated = false

Has the sensor been calibrated yet

Definition at line 50 of file lego-light.h.

int lshigh[16]
Examples:
lego-light-SMUX-test2.c, and lego-light-test2.c.

Definition at line 45 of file lego-light.h.

int lslow[16]
Examples:
lego-light-SMUX-test2.c, and lego-light-test2.c.

Definition at line 44 of file lego-light.h.