In this section, you will learn how to control a large motor, in particular how to initialize one and make it rotate for a specified interval of time. LeJOS, to its credit, has been designed with generalization in mind and therefore, the concepts presented here apply to all motors (that come with EV3 and NXT both). In most cases, substituting the relevant class is all that is required to make a piece of code work for another kind of motor.
Our first program will control a large motor connected to port A of EV3, making it rotate forward for three seconds. The first step is to set up the project directory structure with a folder named
Motor acting as the project root:
Motor | ---- src | ---- Motor.java | ---- build.gradle | ---- ev3 | ...