Arduino, Sharp IR, LCD
2013-07-13 20:53:10
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int IRpin = 0;
void setup() {
lcd.begin(16, 2);
}
void loop() {
lcd.setCursor(0, 0);
lcd.print("Arduino, LCD");
lcd.setCursor(0, 1);
lcd.print("LSD =");
float volts = analogRead(IRpin)*0.0048828125;
float distance = 65*pow(volts, -1.10);
lcd.setCursor(6, 1);
lcd.print(distance);
delay(400);
}