I seem to have hit a "bump". I've got my system working with the Sharp IR and the LCD, but the Sharp IR seems to be spitting out random values only within a range of 930-1023. I don't know why when I adjust an object to be at different distances from the sensor that it just keeps spitting those values out. Anyone know why this may be? Any solution?
Here's the new code that works for me now:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);
int analogPin = 3;
int val = 0;
void setup()
{
lcd.begin(2, 16);
Serial.begin(9600);
}
void loop()
{
val = analogRead(analogPin);
lcd.setCursor(0, 1);
delay(50);
lcd.print(val);
delay(1000);
lcd.clear();
Serial.println(val);
}