O'Reilly logo

Lego Mindstorms EV3 Essentials by Abid H. Mujtaba

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Large motor

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 | ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required