|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ch.aplu.nxt.Part ch.aplu.nxt.Sensor ch.aplu.nxt.I2CSensor ch.aplu.nxt.PrototypeSensor
public class PrototypeSensor
Class that represents a prototype sensor (HiTechnic NXT Prototype Board).
The following register layout is assumed:
Device address 0x02
0x00-0x07 Version number
0x08-0x0F Manufacturer
0x10-0x17 Sensor type
0x42 Analog channel 0, pin A0, upper 8bits
0x43 Analog channel 0, pin A0, lower 2bits
0x44 Analog channel 1, pin A1, upper 8bits
0x45 Analog channel 1, pin A1, lower 2bits
0x46 Analog channel 2, pin A2, upper 8bits
0x47 Analog channel 2, pin A2, lower 2bits
0x48 Analog channel 3, pin A3, upper 8bits
0x49 Analog channel 3, pin A3, lower 2bits
0x4A Analog channel 4, pin A4, upper 8bits
0x4B Analog channel 4, pin A4, lower 2bits
0x4C Digital input channels, bits 0..5
0x4D Digitag output channels, bits 0..5
0x4E Digital control, bits 0..5, low: input (default), high: output
0x4F Sampling time 4..100(ms)
Analog inputs in range 0..3.3V, 10 bit (0..1023)
Digital inputs/outputs 0/3.3V, pins B0..B5, max. 12mA per output (high or low)
Field Summary |
---|
Constructor Summary | |
---|---|
PrototypeSensor()
Creates a sensor instance connected to port S1. |
|
PrototypeSensor(SensorPort port)
Creates a sensor instance connected to the given port. |
Method Summary | |
---|---|
void |
addPrototypeListener(PrototypeListener prototypeListener)
Registers the given prototype listener. |
void |
read(int[] ain,
int[] din)
Reads the sensor. |
void |
readAnalog(int[] ain)
Reads the sensor. |
void |
readDigital(int[] din)
Reads the sensor. |
void |
setDIO(int[] ioControl)
Sets the direction of the 6 digital input/output channels. |
void |
setSamplingPeriod(int period)
Sets the sampling period of the ADC (4..100 ms, default 4 ms). |
void |
write(int[] dout)
Writes the given bit state (low/high) to the digital output channels. |
Methods inherited from class ch.aplu.nxt.I2CSensor |
---|
getData, getLejosI2CSensor, getLejosPort, getProductID, getVersion, sendData, sendData |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PrototypeSensor(SensorPort port)
port
- the port where the sensor is plugged-inpublic PrototypeSensor()
Method Detail |
---|
public void setDIO(int[] ioControl)
ioControl
- the direction of each channel. 0: input, 1: output
(default: all digital channels as input)public void readAnalog(int[] ain)
ain
- an integer array of length 5 where to get the analog valuespublic void readDigital(int[] din)
din
- an integer array of length 6 where to get the digital valuespublic void read(int[] ain, int[] din)
ain
- an integer array of length 5 where to get the analog valuesdin
- an integer array of length 6 where to get the digital valuespublic void write(int[] dout)
dout
- an integer array of length 6 that holds the bit state: 0->low, 1->highpublic void setSamplingPeriod(int period)
period
- the new sampling periodpublic void addPrototypeListener(PrototypeListener prototypeListener)
prototypeListener
- the PrototypeListener to become registered.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |