230 likes | 322 Views
Programming - Motion. Intro to Robotics. Motor Command. The motor command tells the robot to run a motor at a given power level. The example below sets the motor on port 3 to run at full power forwards. Remember, every command ends with a semicolon. Wait Command.
E N D
Programming - Motion Intro to Robotics
Motor Command The motor command tells the robot to run a motor at a given power level. The example below sets the motor on port 3 to run at full power forwards. Remember, every command ends with a semicolon.
Wait Command The comment wait1Msec tells the robot to wait before it executes the next command, for a given time in milliseconds. The value in parenthesis is the amount of time you want the robot to wait. 3000Ms is equal to 3 seconds.
bMotorReflected One way to correct this problem is by using the bMotorReflected statement. To reverse the polarity of the motor, set this statement equal to 1. This reverses the direction in which the motor spins. Reversing the direction of one motor makes it easier to use reflected motors. The same motor command can then be used to run both motors.
Modify this code. Since we are moving at half power lets double our time.
Modify the code, then compile and download. Note what happens.
Modify the code below, then compile and download each time. Note what happens.
Manual Straightening To compensate for the differences between the motors, we could either speed up the slower motor or slow down the faster one. Let’s slow down the faster one.
Save the code with a filename you will remember in your MY DOCUMENTS folder.