Pololu 3pi Robot User Manual
Page 54

void do_play()
{
unsigned char tune_length = read_next_byte();
if(check_data_byte(tune_length))
return;
unsigned char i;
for(i=0;i { if(i > sizeof(music_buffer)) // avoid overflow return; music_buffer[i] = read_next_byte(); if(check_data_byte(music_buffer[i])) return; } // add the end of string character 0 music_buffer[i] = 0; play(music_buffer); } // Clears the LCD void do_clear() { clear(); } // Displays data to the screen void do_print() { unsigned char string_length = read_next_byte(); if(check_data_byte(string_length)) return; unsigned char i; for(i=0;i { unsigned char character; 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); Pololu 3pi Robot User's Guide © 2001–2014 Pololu Corporation 10. Expansion Information Page 54 of 63