I have mounted 2 Sharp IR sensors on my 3Pi angled left and right with the sonar front and center.
I tried to get a sensor read of the left sensor and have it print to the LCD with the following code:
#include <pololu/3pi.h>
#include <stdio.h>
char f;
char r;
char buffer = 25;
int main()
{
set_analog_mode(MODE_8_BIT);
print("Press B"); //printing "Press B" to the LCD
//Waiting for button to be pressed
while (!button_is_pressed(BUTTON_B));
wait_for_button_release(BUTTON_B); //code above is executed while button b is pressed and this code looks for the release.
while(1)
{
clear();
unsigned char l = analog_read(7);
delay_ms(1000);
print_long (l);
}
return 0;
}
It will print out the “Press B”, but after button press, it goes blank.
To check to see if the sensors worked, I checked voltages - OK, then loaded the wall follower code. Even though it is set up for 2 sharp sensors, it did take off and avoid walls and objects.
Any ideas on why it won’t print to the screen?