Running Motors Simultaneously

Now that I am able to establish a Bluetooth connection with the NXT brick and I am able to get the robot to turn when I hit a button on the form, it is time to explore how to get the robot to move forward (i.e. have two motors run simultaneous while clicking only one button).  At first, I tried to use the “coast command” that Fokke included in his tutorial.  However, I was unable to get the robot to respond to this command.  Instead, I used the turn command and set the amount of degrees for the motor to turn to zero.  In the click event procedure for the forward button in my form, I included the turn command (degrees set to zero) for the two motors connected to ports B and C on the NXT.  When I ran the application and clicked the button, the robot moved forward.  I realized, however, that I had no way of stopping the robot.  I actually had to turn off the NXT brick to get it to stop.  I decided to use the “brake command” to stop the robot.  To do this, I added a new button to the form named “stop” and included the brake command for both motors in the button’s click event procedure.  Finally, following the same process I used to get the robot to move forward, I made a new button named “back” that moved the robot backwards. 

Leave a Comment