373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
p_den = constants[2];
d_num = constants[3];
d_den = constants[4];
// enable pid
pid_enabled = 1;
}
// Turns off PID
void
stop_pid()
{
set_motors(0,0);
pid_enabled = 0;
}
/////////////////////////////////////////////////////////////////////
int
main()
{
pololu_3pi_init(2000);
play_mode(PLAY_CHECK);
clear();
print(
"Slave"
);
// start receiving data at 115.2 kbaud
serial_set_baud_rate(115200);
serial_set_mode(SERIAL_CHECK);
serial_receive_ring(buffer, 100);
while
(1)
{
// wait for a command
char
command = read_next_byte();
// The list of commands is below: add your own simply by
// choosing a command byte and introducing another case
// statement.
switch
(command)
{
case
(
char
)0x00:
// slient error - probable master resetting
break
;
case
(
char
)0x81:
send_signature();
break
;
case
(
char
)0x86:
send_raw_sensor_values();
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
;
Pololu 3pi Robot User’s Guide
© 2001–2019 Pololu Corporation
10. Expansion Information
Page 74 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...