Help with 3pi

necessary that the robot around in a loop and stop
how do I put a start and stop time after

and how to use the PID? My 3pi this with a good time however I know that could improve

I am using the following program

My LCD does not work will be I did something wrong?

[code]#include <pololu/3pi.h>
#include <avr/pgmspace.h>
#include <pololu/orangutan.h>
#include <pololu/qtr.h>
#include <pololu/encoders.h>
#include <pololu/analog.h>
#include <pololu/buzzer.h>
#include <pololu/time.h>
#include <pololu/motors.h>
#include <pololu/lcd.h>
#include <pololu/leds.h>
#include <pololu/pushbuttons.h>
#include <pololu/serial.h>

const char welcome_line1[] PROGMEM = " Pololu";
const char welcome_line2[] PROGMEM = “3\xf7 Robot”;
const char demo_name_line1[] PROGMEM = “Line”;
const char demo_name_line2[] PROGMEM = “follower”;

const char welcome[] PROGMEM = “>g32>>c32”;
const char go[] PROGMEM = “L16 cdegreg4”;

const char levels[] PROGMEM = {
0b00000,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000,
0b11111,
0b11111,
0b11111,
0b11111,
0b11111,
0b11111,
0b11111
};

void load_custom_characters()
{
lcd_load_custom_character(levels+0,0);
lcd_load_custom_character(levels+1,1);
lcd_load_custom_character(levels+2,2);
lcd_load_custom_character(levels+3,3);
lcd_load_custom_character(levels+4,4);
lcd_load_custom_character(levels+5,5);
lcd_load_custom_character(levels+6,6);
clear();
}

void display_readings(const unsigned int *calibrated_values)
{
unsigned char i;

for(i=0;i<5;i++) {
	
	const char display_characters[10] = {' ',0,0,1,2,3,4,5,6,255};
	
	char c = display_characters[calibrated_values[i]/101];
	
	print_character(c);
}

}

int integral;
int last_proportional;

void initialize()
{
unsigned int counter;
unsigned int sensors[5];

pololu_3pi_init(2000);
load_custom_characters();

print_from_program_space(welcome_line1);
lcd_goto_xy(0,1);
print_from_program_space(welcome_line2);
play_from_program_space(welcome);
delay_ms(1000);

clear();
print_from_program_space(demo_name_line1);
lcd_goto_xy(0,1);
print_from_program_space(demo_name_line2);
delay_ms(1000);

while(!button_is_pressed(BUTTON_B))
{
	int bat = read_battery_millivolts();
	
	clear();
	print_long(bat);
	print("mV");
	lcd_goto_xy(0,1);
	print("Press B");
	
	delay_ms(100);
}

wait_for_button_release(BUTTON_B);
delay_ms(1000);

for(counter=0;counter<80;counter++)
{
if(counter < 20 || counter >= 60)
set_motors(40,-40);
else
set_motors(-40,40);

calibrate_line_sensors(IR_EMITTERS_ON);

delay_ms(20);

}
set_motors(0,0);

while(!button_is_pressed(BUTTON_B))
{
unsigned int position = read_line(sensors,IR_EMITTERS_ON);

clear();
print_long(position);
lcd_goto_xy(0,1);
display_readings(sensors);

delay_ms(100);

}
wait_for_button_release(BUTTON_B);

clear();

print(“Go!”);

play_from_program_space(go);
while(is_playing());
}

int main()

{
int last_proportional;
unsigned int sensors[5];

initialize();

while(1)
{
	unsigned int position = read_line_white(sensors,IR_EMITTERS_ON);
	
	if(position < 1000)
	{
		
		set_motors(35,155);
		
		left_led(0);
		right_led(1);
	}
	else if(position < 3000)
	{
		set_motors(150,150);
		left_led(0);
		right_led(0);
	}
	else
	{
		set_motors(155,35);
		left_led(1);
		right_led(0);
	}
}

}[/code]

Hello.

It sounds like you have several questions about how to use the 3pi. Let’s start by troubleshooting your LCD screen, since that will be useful for the rest of your questions. It looks like you’ve started to ask about your LCD screen in another thread on our forum; can you answer the questions David responded with in that other thread?

-Jon