![Pololu Zumo Shield For Arduino Скачать руководство пользователя страница 46](http://html1.mh-extra.com/html/pololu/zumo-shield-for-arduino/zumo-shield-for-arduino_user-manual_1574974046.webp)
A Zumo robot preparing to attack a
Parallax SumoBot.
Zumo reflectance sensor array on a
Zumo robot, bottom view.
This example demonstrates how to program an Arduino-controlled Zumo equipped with a reflectance
sensor array to drive around and stay within a sumo ring. Note that it only uses the two outermost
sensors on the array, which are sufficient for border detection. With the
[https://www.pololu.com/docs/0J57/6]
installed, the sketch file can be opened in Arduino by selecting
File > Examples > ZumoShield > BorderDetect
.
You might need to edit a few things in this sketch to make it work well with your Zumo:
• If one or both of your motors have been connected backwards, uncomment the
flipLeftMotor
or
flipRightMotor
lines to correct their directions.
• Adjust the speeds and duration definitions at the top of the sketch. Generally, lower speeds
and shorter durations should work better with faster motors, while higher speeds and longer
durations should be more appropriate for slower motors. We found that these default values
worked well with a Zumo using
[https://www.pololu.com/product/2361]
• Finally, the sensor reading threshold used to differentiate between black and white surfaces,
QTR_THRESHOLD
, might need to be changed to suit your lighting and ring conditions.
Upload the sketch to an Arduino mounted on a Zumo, place the Zumo on a sumo ring (or a similar
large dark surface with a light border), and press the user pushbutton. Be ready to catch the Zumo
in case it drives off the ring! If everything works right, the Zumo should sound a countdown with its
buzzer and then start driving forward until it detects the ring border; it should then back up, turn, and
continue. If not, try adjusting some of the parameters as described above. Here are some specific
troubleshooting tips:
• If the Zumo overshoots the ring border, try lowering
FORWARD_SPEED
(especially if it is going
very fast) or reducing
QTR_THRESHOLD
.
• If the Zumo stops at the border but turns too much or not enough before continuing, adjust
TURN_SPEED
and/or
TURN_DURATION
.
Pololu Zumo Shield for Arduino User’s Guide
© 2001–2019 Pololu Corporation
7. Example sketches
Page 46 of 52