ukcrobots.core
Class TouchSensor
java.lang.Object
|
+--ukcrobots.core.Sensor
|
+--ukcrobots.core.TouchSensor
- public class TouchSensor
- extends Sensor
Model a touch sensor as a device returning boolean values.
- Version:
- 2001.12.20
- Author:
- d.j.barnes @at@ kent.ac.uk
Constructor Summary |
TouchSensor(int id)
Create a touch sensor. |
Method Summary |
boolean |
isPressed()
Interprets the value of the sensor as a boolean value |
TouchSensor
public TouchSensor(int id)
throws NoSuchDeviceException
- Create a touch sensor.
- Parameters:
id
- Which input port the sensor is connected to: 1, 2, or 3.
- Throws:
NoSuchDeviceException
- if the port id is not recognised.
isPressed
public boolean isPressed()
- Interprets the value of the sensor as a boolean value
- Returns:
- true if the sensor is pressed, false otherwise.