The Motion Program
This is the basic program you would need to make your robot drive. It can be altered and shortened from what is shown but this is the standard from which you should start. It allows the robot to preform any type of motion you would like.
To begin you will need the three blocks to the left.
Lets walk through how to write it. The first block is a reset block. This is so that the robot can start on 0 degrees and can measure the distance traveled without any math. This block can be removed if you do not want to use the rotation sensor or you do not want to start from 0.
Next is two motor blocks. Everything inside should be set the similar to each other. One set to port B and the other to C. Power and direction will vary dependent on how you want your robot to move. Taking forwards as example, both powers would be set equal and in the same direction clockwise. These blocks should always be set to duration unlimited.
Next is the wait block. This block is what makes the whole program wait on a sensor to determine when to stop. This can be set to whatever sensor you wish but for the program below we set it to wait on the rotation sensor for 360 degrees of rotation clockwise.
Finally you finish the program with another two motor blocks set to ports B and C. Both should be set to stop. This is so that once the condition of the wait block is achieved, the robot will stop on the spot. So when the robot drives 360 degrees forward, it will stop right on the 360th degree or as close as the motors can get.
To begin you will need the three blocks to the left.
Lets walk through how to write it. The first block is a reset block. This is so that the robot can start on 0 degrees and can measure the distance traveled without any math. This block can be removed if you do not want to use the rotation sensor or you do not want to start from 0.
Next is two motor blocks. Everything inside should be set the similar to each other. One set to port B and the other to C. Power and direction will vary dependent on how you want your robot to move. Taking forwards as example, both powers would be set equal and in the same direction clockwise. These blocks should always be set to duration unlimited.
Next is the wait block. This block is what makes the whole program wait on a sensor to determine when to stop. This can be set to whatever sensor you wish but for the program below we set it to wait on the rotation sensor for 360 degrees of rotation clockwise.
Finally you finish the program with another two motor blocks set to ports B and C. Both should be set to stop. This is so that once the condition of the wait block is achieved, the robot will stop on the spot. So when the robot drives 360 degrees forward, it will stop right on the 360th degree or as close as the motors can get.