We use the touch sensor to learn how LeJOS handles sensors. Our aim is to set up the sensor and detect when the touch sensor is pressed. Once again, the first step is to set up the project structure with the root folder named
Touch | ---- src | ---- Touch.java | ---- TouchSensor.java | ---- build.gradle | ---- ev3 | ---- DBusJava | ---- ev3classes
build.gradle file is set up as usual with the main class named
Touch after both the root folder name and the
Touch class (inside the
Touch.java file), which contains the
main() function where the execution starts.
LeJOS treats EV3 sensors in a consistent and generalized fashion. This means that the class for each EV3 sensor implements a