Control multiple motors with JetStorm

There are three ways to control motors in JetStorm.

  • control only one motor by selecting the letter of the motor: A, B, C or D.
|ev3 command| 

ev3 := Ev3Vehicle newIp: '192.168.1.3' daisyChain: #EV3. 

ev3 motorA startAtSpeed: 50. 
2 seconds wait. 
ev3 motorA stop. 

ev3 bridge disconnect.
  • control the two synchronized motors: first of all we need to parametrize the synchronized motors by selecting the two concerned motors.
|ev3 command| 

ev3 := Ev3Vehicle newIp: '192.168.1.3' daisyChain: #EV3. 

ev3 syncMotorsLeft: ev3 motorA right: ev3 motorB. 
ev3 motorSync startAtSpeed: 50. 
2 seconds wait. 
ev3 motorSync stop. 

ev3 bridge disconnect.

Now, there is another way to control multiple motors: we created the class MultiMotors that allows to control more than 2 motors at the same time. Here is an example to control the 4 motors at the same time:

|ev3 command| 

ev3 := Ev3Vehicle newIp: '192.168.1.3' daisyChain: #EV3. 

ev3 multiMotors addMotor: ev3 motorA; 
    addMotor: ev3 motorB; 
    addMotor: ev3 motorC; 
    addMotor: ev3 motorD. 

ev3 multiMotors startAtSpeed: 50. 
2 seconds wait. 
ev3 multiMotors stop. 

ev3 bridge disconnect.

That’s all for multimotors. It is a subclass of Motors, so you can use the multimotors as a single motor.