Sharp / MAxBotix EZ3 Sensor Issue

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()
        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.


        unsigned char l = analog_read(7);


        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?


You are clearing the LCD right after you print to it; try swapping the delay_ms and print_long lines.

- Ryan

That did it! Thanks! With the clear on the top end, I overlooked it. I liked it so much, I used the lcd_goto and positioned all 3 sensor reads on the LCD.