B. serial master program – Pololu 3pi Robot User Manual

Page 56

Advertising
background image

break;

case (char)0x87:

send_calibrated_sensor_values(1);

break;

case (char)0xB0:

send_trimpot();

break;

case (char)0xB1:

send_battery_millivolts();

break;

case (char)0xB3:

do_play();

break;

case (char)0xB4:

calibrate_line_sensors(IR_EMITTERS_ON);

send_calibrated_sensor_values(1);

break;

case (char)0xB5:

line_sensors_reset_calibration();

break;

case (char)0xB6:

send_line_position();

break;

case (char)0xB7:

do_clear();

break;

case (char)0xB8:

do_print();

break;

case (char)0xB9:

do_lcd_goto_xy();

break;

case (char)0xBA:

auto_calibrate();

break;

case (char)0xBB:

set_pid();

break;

case (char)0xBC:

stop_pid();

break;

case (char)0xC1:

m1_forward();

break;

case (char)0xC2:

m1_backward();

break;

case (char)0xC5:

m2_forward();

break;

case (char)0xC6:

m2_backward();

break;

default:

clear();

print("Bad cmd");

lcd_goto_xy(0,1);

print_hex_byte(command);

play("o7l16crc");

continue; // bad command

}

}

}

10.b. Serial master program

A serial master program used to control the serial slave program is included with the Pololu AVR Library (see

Section

6

) in

libpololu-avr\examples\atmegaxx8\3pi-serial-master

. The program is designed to run on an

Orangutan

SV-xx8

[http://www.pololu.com/product/1227]

,

LV-168

[http://www.pololu.com/product/775]

, or 3pi as a demonstration of what

is possible, but you will probably want to adapt it for your own controller. To use the program, make the following
connections between your master and slave:

Pololu 3pi Robot User's Guide

© 2001–2014 Pololu Corporation

10. Expansion Information

Page 56 of 63

Advertising