Setting Motor Power
Below is the selection of blocks you see when you click on Actuators > DcMotor. Which of these do you think will be the one we want to choose to send power to a wheel?
Building the Block Code
Now that you know which block to use, go ahead and build the block code in the app. Remember: we need to send power to all the wheels.
PAUSE HERE AND GO BUILD YOUR CODE
When you’re done, come back and reveal the solution to see if your code matches ours.
Up Your Game: There is another more efficient way to create the blocks to power the wheels. Programming is often not only about getting something done, but doing it with as few steps as possible. Where else in the blocks menu might you find blocks to set motor power?
Aha! We hope you see that exploring the blocks in your toolbox often reveals a better way to accomplish a task.
What power should I use?
Often in programming you need to set a value. Sometimes you have the opportunity to define what that value means before setting it, but often you have to work within the constraints of the existing software. In this case, the “power” value we “set” for each wheel is determined by the VRS App. The only way you can figure out what the power should be is to experiment. Remember: in most cases you don’t have to use whole numbers only; numbers can be negative, decimals, or both!