Package lejos.hardware.sensor
Class MindsensorsLightSensorArray
- java.lang.Object
-
- lejos.hardware.Device
-
- lejos.hardware.sensor.BaseSensor
-
- lejos.hardware.sensor.I2CSensor
-
- lejos.hardware.sensor.MindsensorsLightSensorArray
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,SensorConstants,SensorMode,SensorModes,SampleProvider
public class MindsensorsLightSensorArray extends I2CSensor
MindSensors Light Senor Array
This sensor an array of 8 sensors with controlled light source, returning you values of the sensor readings.The code for this sensor has not been tested. Please report test results to the leJOS forum.
Supported modes Mode name Description unit(s) Getter Red Measures the light value when illuminated with a red light source. N/A, normalized getRedMode()Sensor configuration
The sensor can be calibrated for black and white using the calibrateWhite and calibrateBlack methods.The sensor can be put in and out of sleep mode (lights off) using the sleep method and wakeUp methods.
See Sensor datasheet See Sensor Product page See The leJOS sensor framework See
leJOS conventions for SampleProviders- Author:
- Juan Antonio Brenha Moral, Eric Pascual (EP)
-
-
Field Summary
-
Fields inherited from class lejos.hardware.sensor.I2CSensor
address, DEFAULT_I2C_ADDRESS, port, REG_PRODUCT_ID, REG_VENDOR_ID, REG_VERSION, retryCount
-
Fields inherited from class lejos.hardware.sensor.BaseSensor
currentMode, modes
-
Fields inherited from interface lejos.hardware.sensor.SensorConstants
BLACK, BLANK_INDEX, BLUE, BLUE_INDEX, BROWN, GREEN, GREEN_INDEX, MAX_TYPE, MIN_TYPE, MODE_RAW, NXT_ADC_RES, RED, RED_INDEX, TYPE_ANGLE, TYPE_COLORBLUE, TYPE_COLORFULL, TYPE_COLORGREEN, TYPE_COLORNONE, TYPE_COLORRED, TYPE_CUSTOM, TYPE_HIGHSPEED, TYPE_HIGHSPEED_9V, TYPE_HISPEED, TYPE_LIGHT_ACTIVE, TYPE_LIGHT_INACTIVE, TYPE_LOWSPEED, TYPE_LOWSPEED_9V, TYPE_NO_SENSOR, TYPE_REFLECTION, TYPE_SOUND_DB, TYPE_SOUND_DBA, TYPE_SWITCH, TYPE_TEMPERATURE, WHITE, YELLOW
-
-
Constructor Summary
Constructors Constructor Description MindsensorsLightSensorArray(I2CPort port)ConstructorMindsensorsLightSensorArray(I2CPort port, int address)ConstructorMindsensorsLightSensorArray(Port port)ConstructorMindsensorsLightSensorArray(Port port, int address)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcalibrateBlack()voidcalibrateWhite()SensorModegetRedMode()Return a sample provider in that measures the light reflection of a surface illuminated with a red led light.protected voidinit()voidsendCommand(char cmd)Send a single byte command represented by a lettervoidsleep()Sleep the sensorvoidwakeUp()Wake up the sensor-
Methods inherited from class lejos.hardware.sensor.I2CSensor
fetchString, getAddress, getData, getData, getPort, getProductID, getRetryCount, getVendorID, getVersion, sendData, sendData, sendData, setAddress, setRetryCount
-
Methods inherited from class lejos.hardware.sensor.BaseSensor
fetchSample, getAvailableModes, getCurrentMode, getMode, getMode, getModeCount, getName, sampleSize, setCurrentMode, setCurrentMode, setModes
-
Methods inherited from class lejos.hardware.Device
close, releaseOnClose
-
-
-
-
Constructor Detail
-
MindsensorsLightSensorArray
public MindsensorsLightSensorArray(I2CPort port, int address)
Constructor- Parameters:
port-address- I2C address for the device
-
MindsensorsLightSensorArray
public MindsensorsLightSensorArray(I2CPort port)
Constructor- Parameters:
port-
-
MindsensorsLightSensorArray
public MindsensorsLightSensorArray(Port port, int address)
Constructor- Parameters:
port-address- I2C address for the device
-
MindsensorsLightSensorArray
public MindsensorsLightSensorArray(Port port)
Constructor- Parameters:
port-
-
-
Method Detail
-
init
protected void init()
-
sendCommand
public void sendCommand(char cmd)
Send a single byte command represented by a letter- Parameters:
cmd- the command to be sent
-
sleep
public void sleep()
Sleep the sensor
-
wakeUp
public void wakeUp()
Wake up the sensor
-
calibrateWhite
public void calibrateWhite()
-
calibrateBlack
public void calibrateBlack()
-
getRedMode
public SensorMode getRedMode()
Return a sample provider in that measures the light reflection of a surface illuminated with a red led light. The sensor houses 8 light sensors. Each element in the sample represents one light sensor.
-
-