The five basic commands you need to operate your RoboCar are:
If you do not put a value between the parentheses (), the motor will run at full speed. If you put in a decimal value less that one, it will run at a slower speed. For example:
The RoboCar will go forward at half speed. (A half (1/2) in decimal is written as 0.5)
time.sleep() function tells the command in the line above
it how long to operate. The sleep function understands that the
value within the parentheses is the time you want in seconds. That
time can be a large number (
time.sleep(1000)) or a very
small number (
time.sleep(0.2)). You can use different time intervals to control your RoboCar’s actions.
Use the “Cut and Paste” shortcut to limit the amount of code you have to type into your program. Use the Cut and Paste handout sheet in your kit to help you.