Pololu 3pi Robot User Manual

Page 49

Advertising
background image

Command

byte

Command

Data

bytes

Response

bytes

Description

0x81

signature

0

6

Sends the slave name and code version, e.g. “3pi1.0”. This
command also sets motor speeds to 0 and stops PID line
following, if active, so it is useful as an initialization
command.

0x86

raw sensors

0

10

Reads all five IR sensors and sends the raw values as a
sequence of two-byte ints, in the range 0-2000

0x87

calibrated sensors 0

10

Reads all five IR sensors and sends calibrated values as a
sequence of two-byte ints, in the range 0-1000

0xB0

trimpot

0

2

Sends the voltage output of the trimpot as a two-byte int, in
the range 0-1023

0xB1

battery millivolts

0

2

Sends the battery voltage of the 3pi in mV, as a two-byte int

0xB3

play music

2-101 0

Plays a tune specified by a string of musical commands. The
first data byte specifies the length of the following string
(max length 100), so that the slave program knows how
many more data bytes to read. See the play() command
in

Section 3

of the

Pololu AVR Library Command

Reference

for a description of the musical command format.

0xB4

calibrate

0

10

Performs one round of calibration on the sensors, reads all
five IR sensors, and sends calibrated values as a sequence
of two-byte ints, in the range 0-1000. This should be called
multiple times, as the robot moves over a range from white
to black.

0xB5

reset calibration

0

0

Resets the calibration. This should always be used when
connecting to a slave, in case the master reset without a slave
reset, for example in case of a power glitch.

0xB6

line position

0

2

Reads all five IR sensors using calibrated values and
estimates the position of a black line under the robot. The
value, which is sent back as a two-byte integer, is 0 when the
line is under sensor PC0 or farther to the left, 1000 when the
line is directly under sensor PC1, up to 4000 when it is under
sensor PC4 or farther to the right. See

Section 19

of of the

Pololu AVR Library Command Reference

for the formula

used to estimate position.

0xB7

clear LCD

0

0

Clears the LCD screen on the 3pi.

0xB8

print

2-9

0

Prints 1-8 characters to the LCD. The first byte is the length
of the following string of characters, as with the play
command above.

0xB9

LCD goto xy

2

0

Moves the LCD cursor to x-y coordinates given by the next
two bytes.

Pololu 3pi Robot User's Guide

© 2001–2014 Pololu Corporation

10. Expansion Information

Page 49 of 63

Advertising