Monday, 11 February 2013

Basic Motor Control


Basic Motor Control

The timing and control of motor actions can be tricky. For example, consider the snippet

# pragma config (Motor , motorC , Left , tmotorNormal , PIDControl )
task main () {
motor [ Left ] = 50;
}

This program will exit immediately leaving no time for the motor to turn. Adding a wait
command,

# pragma config (Motor , motorC , Left , tmotorNormal , PIDControl )
task main () {
motor [ Left ] = 50;
wait1Msec (1000);
}

will cause the motor to run for 1 second at half power.

No comments:

Post a Comment