Warning: call_user_func_array() expects parameter 1 to be a valid callback, no array or string given in /home3/validus/public_html/wp-includes/class-wp-hook.php on line 298

03 – Programming and Testing the Microbot motors

The two motors of the Microbot can be programmed to move the Microbot in every possible direction. Four output pins are used to control the two motors. Output pin B.7 rotate the right motor backwards and output pin B.6 rotate the right motor in a forward direction. Output pin B.5 rotate the left motor backwards and output pin B.4 rotate the left motor in a forward direction. By combining the motor controls in specific ways a number of motions can be obtained. The table lists the available control options.

Motion

Left Motor

 Left Motor

 Right Motor

 Right Motor

Backward (B.5) Forward (B.4) Backward (B.7) Forward (B.6)
Halt Low  Low Low Low
Forward Low  High Low High
Backward High Low High Low
Turn Left High  Low Low High
Turn Right Low  High High Low
Veer Left Forward Low  Low Low High
Veer Left Backward Low  Low High Low
Veer Right Forward Low  High Low Low
Veer Right Backward High  Low Low Low

A ‘turn’ motion is an ‘on the spot spin’ and is created by switching one motor forward and the other motor backward. In a ‘veer’ motion only one motor is switched and the other motor is inactive, this creates a wider turn.


 

To simplify things one can use the Forward, Backward and Halt commands to control the two motors. The following table list the shortcut commands.

Motion

Left Motor (A)

Right Motor (B)

Halt Halt A  Halt B
Forward Forward A Forward B
Backward Backward A  Backward B
Turn Left Backward A  Forward B
Turn Right Forward A  Backward B
Veer Left Forward Halt A  Forward B
Veer Left Backward Halt A  Backward B
Veer Right Forward Forward A  Halt B
Veer Right Backward Forward A  Halt B

The following program illustrates all the possible motor movements.

The rest of the code is given in part 2 below.

You can download the program file, Bot120 Motor Test by right clicking on it and selecting ‘save link as’ from the popup menu.