|
SunSPOT API V6.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.spot.resources.Resource
com.sun.spot.sensorboard.io.ScalarInput
com.sun.spot.sensorboard.peripheral.LightSensor
public class LightSensor
Simple extension of ScalarInput.
| Field Summary |
|---|
| Fields inherited from class com.sun.spot.sensorboard.io.ScalarInput |
|---|
index, myController, range, thIsolates, thListeners |
| Constructor Summary | |
|---|---|
LightSensor(PinDescriptor pidx,
int r,
IADCController cntrl)
Creates a new instance of LightSensor |
|
| Method Summary | |
|---|---|
void |
addILightSensorThresholdListener(ILightSensorThresholdListener who)
Adds the specified light sensor threshold listener to receive callbacks from this light sensor. |
SensorEvent |
createSensorEvent()
Create a SensorEvent of the appropriate type for this sensor. |
double |
getAccuracy()
Returns the accuracy of the sensor (in the current measurement range) as a percentage of reading (=data value). |
int |
getAverageValue()
Take 17 readings, one every 1 msec and average them. |
int |
getAverageValue(int n)
To deal with light sources that change rapidly over time, such as fluorescent light bulbs, it is necessary to take multiple readings and average them. |
ILightSensorThresholdListener[] |
getILightSensorThresholdListeners()
Returns an array of all the light sensor threshold listeners registered on this light sensor. |
double |
getMaxValue()
Returns the current maximum value of the sensor (in the current measurement range). |
double |
getMinValue()
Returns the current minimum value of the sensor (in the current measurement range). |
double |
getResolution()
Returns the resolution of the range (in the current measurement range). |
void |
removeILightSensorThresholdListener(ILightSensorThresholdListener who)
Removes the specified light sensor threshold listener so that it no longer receives callbacks from this light sensor. |
void |
saveEventState(SensorEvent evt)
Save the current sensor state in the specified event. |
| Methods inherited from class com.sun.spot.resources.Resource |
|---|
addTag, getTags, getTagValue, hasTag, removeTag |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.sun.spot.sensorboard.io.IScalarInput |
|---|
addIScalarInputThresholdListener, areThresholdEventsEnabled, enableThresholdEvents, getHighThreshold, getIndex, getIScalarInputThresholdListeners, getLowThreshold, getRange, getValue, removeIScalarInputThresholdListener, setThresholds, supportsThresholdEvents |
| Methods inherited from interface com.sun.spot.resources.transducers.ITransducer |
|---|
getDescription, getMaxSamplingRate |
| Methods inherited from interface com.sun.spot.resources.IResource |
|---|
addTag, getTags, getTagValue, hasTag, removeTag |
| Methods inherited from interface com.sun.spot.resources.transducers.ILightSensor |
|---|
getValue |
| Methods inherited from interface com.sun.spot.resources.transducers.ITransducer |
|---|
getDescription, getMaxSamplingRate |
| Methods inherited from interface com.sun.spot.resources.IResource |
|---|
addTag, getTags, getTagValue, hasTag, removeTag |
| Constructor Detail |
|---|
public LightSensor(PinDescriptor pidx,
int r,
IADCController cntrl)
pidx - PinDescriptor that the lightsensor is connected tor - Range of the mask for the above pincntrl - the ADC controller to use| Method Detail |
|---|
public int getAverageValue(int n)
throws IOException
getAverageValue in interface ILightSensorn - the number of readings to take.
IOException
public int getAverageValue()
throws IOException
getAverageValue in interface ILightSensorIOExceptionpublic void addILightSensorThresholdListener(ILightSensorThresholdListener who)
who - the light sensor threshold listener to add.public void removeILightSensorThresholdListener(ILightSensorThresholdListener who)
who - the light sensor threshold listener to remove.public ILightSensorThresholdListener[] getILightSensorThresholdListeners()
public double getMinValue()
getMinValue in interface IMeasurementInfogetMinValue in class ScalarInputpublic double getMaxValue()
getMaxValue in interface IMeasurementInfogetMaxValue in class ScalarInputpublic double getResolution()
getResolution in interface IMeasurementInfogetResolution in class ScalarInputpublic double getAccuracy()
getAccuracy in interface IMeasurementInfogetAccuracy in class ScalarInputpublic SensorEvent createSensorEvent()
ITransducer
createSensorEvent in interface ITransducercreateSensorEvent in class ScalarInputpublic void saveEventState(SensorEvent evt)
ITransducer
saveEventState in interface ITransducersaveEventState in class ScalarInputevt - the event to store the sensor state in
|
SunSPOT API V6.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||