when
when Arduino starts up"
Arduino starts up".
2. Click, hold, and drag until you see the
Sp_Forward
Sp_Forward block. You will notice comments on what input
bubble controls which motor. The orientation of the robot for these comments is the rear of the robot
facing you.
3. Click on the left input bubble and insert any whole number between 0 and 255. Input the same number
into the right bubble. We use what is known as pulse width modulation, or PWM for short, to control the
speed of the robot. For more info on this click here. Basically, 0 is o and 255 is the maximum speed. You
can adjust the speed of how fast you want your car to go in a straight line by inserting numbers less than
255 for example, the value of 180 will drive the motors slowly. On some tracks going at full speed will
cause the car to crash through a wall. experiment with di erent values to get the best results.
4. Locate the
Sp_Left
Sp_Left block. The rst bubble controls how fast the one wheel turns forward and the other
controls how fast the other wheel travels backwards. Reversing one of the wheels during a turn will cause
the robot to make a sharper turn. Experiment with di erent turning and breaking speeds to nd the
optimal turn around a corner.
5. Locate the
Sp_Right
Sp_Right block. The rst bubble controls how fast the one wheel turns backwards and the
other controls how fast the other wheel travels forwards. Reversing one of the wheels during a turn will
cause the robot to make a sharper turn. Experiment with di erent turning and breaking speeds to nd
the optimal turn around a corner.
6. Connect your car to your computer and upload the code to the computer. You can refer to the beginning
of this section for a refresher on how to upload code to an Arduino Nano.
Autonomous Robot Racer: Scratch Mode: Page 59
Autonomous Robot Racer: Scratch Mode: Page 60
Autonomous Robot Racer: Scratch Mode: Page 61
Autonomous Robot Racer: Scratch Mode: Page 62
Autonomous Robot Racer: Scratch Mode: Page 63
Autonomous Robot Racer: Scratch Mode: Page 64
Autonomous Robot Racer: Scratch Mode: Page 65
Autonomous Robot Racer: Scratch Mode: Page 66
Autonomous Robot Racer: Scratch Mode: Page 67
Autonomous Robot Racer: Scratch Mode: Page 68
Autonomous Robot Racer: Scratch Mode: Page 69
Autonomous Robot Racer: Scratch Mode: Page 70
|