311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
character = read_next_byte();
if
(check_data_byte(character))
return
;
// Before printing to the LCD we need to go to AUTOMATIC mode.
// Otherwise, we might miss characters during the lengthy LCD routines.
serial_set_mode(SERIAL_AUTOMATIC);
print_character(character);
serial_set_mode(SERIAL_CHECK);
}
}
// Goes to the x,y coordinates on the lcd specified by the two data bytes
void
do_lcd_goto_xy()
{
unsigned
char
x = read_next_byte();
if
(check_data_byte(x))
return
;
unsigned
char
y = read_next_byte();
if
(check_data_byte(y))
return
;
lcd_goto_xy(x,y);
}
// Runs through an automatic calibration sequence
void
auto_calibrate()
{
time_reset();
set_motors(60, -60);
while
(get_ms() < 250)
calibrate_line_sensors(IR_EMITTERS_ON);
set_motors(-60, 60);
while
(get_ms() < 750)
calibrate_line_sensors(IR_EMITTERS_ON);
set_motors(60, -60);
while
(get_ms() < 1000)
calibrate_line_sensors(IR_EMITTERS_ON);
set_motors(0, 0);
serial_send_blocking(
"c"
,1);
}
// Turns on PID according to the supplied PID constants
void
set_pid()
{
unsigned
char
constants[5];
unsigned
char
i;
for
(i=0;i<5;i++)
{
constants[i] = read_next_byte();
if
(check_data_byte(constants[i]))
return
;
}
// make the max speed 2x of the first one, so that it can reach 255
max_speed = (constants[0] == 127 ? 255 : constants[0]*2);
// set the other parameters directly
p_num = constants[1];
Pololu 3pi Robot User’s Guide
© 2001–2019 Pololu Corporation
10. Expansion Information
Page 73 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...