Pololu 3pi robot on a 3/4" black line.
7. Example Project #1: Line Following
7.a. About Line Following
Now that you have learned how to compile a
simple program for the 3pi, it’s time to teach your
robot do something more complicated. In this
example project, we’ll show you how to make
your 3pi follow a black line on a white
background, by coordinating its sensors and
motors. Line following is a great introduction to
robot programming, and it makes a great
contest: it’s easy to build a line-following course,
the rules are simple to understand, and it’s not
hard to program your 3pi to follow a line.
Optimizing your program to make your 3pi zoom
down the line at the highest speed possible,
however, is a challenge that can introduce you
to some advanced programming concepts.
A great looking line following course can be constructed for a few dollars in a couple of hours at home.
For information on building your own course, see our tutorial on
Building Line Following and Line
[https://www.pololu.com/docs/0J22]
.
7.b. A Simple Line-Following Algorithm for 3pi
A simple line following program for the 3pi is available in the folder
examples\atmegaxx8\3pi-
linefollower
.
Note:
An Arduino-compatible version of this sample program can be downloaded as part
of the
[https://www.pololu.com/docs/0J17]
(see
The source code demonstrates a variety of different features of the 3pi, including the line sensors,
motors, LCD, battery voltage monitor, and buzzer. The program has two phases.
The first phase of the program is the initialization and calibration phase, which is handled by the
function
intitialize()
. This function is called once, at the beginning of the
main()
function, before
anything else happens, and it takes care of the following steps:
Pololu 3pi Robot User’s Guide
© 2001–2019 Pololu Corporation
7. Example Project #1: Line Following
Page 27 of 85
Содержание 0J5840
Страница 24: ...Pololu 3pi Robot User s Guide 2001 2019 Pololu Corporation 5 How Your 3pi Works Page 24 of 85...
Страница 67: ...Source code Pololu 3pi Robot User s Guide 2001 2019 Pololu Corporation 10 Expansion Information Page 67 of 85...
Страница 77: ...Source code Pololu 3pi Robot User s Guide 2001 2019 Pololu Corporation 10 Expansion Information Page 77 of 85...