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

Programming the differential drive

With the LeJOS project set up and tested, it is now time to implement the software that controls the differential drive. This is where the modular approach to programming comes in. From an implementation standpoint, the differential drive is simply one part of the robot, the part that controls its motion.

We already know that we require only four controls in our drive: forward, stop, rotate clockwise, and rotate counterclockwise. These four types of motion are achieved by controlling the two motors, left and right. With this in mind, we write a separate DifferenentialDrive class (in a separate Java file src/DifferentialDrive.java) that has four methods corresponding to the four types of motion. Each method when ...

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