#include <LiquidCrystal.h>
int sensorPin= A0; // select the input pin for the potentiometer
int sensorValue= 0; // variable to store the value coming from the sensor
const int rs= 12, en= 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup() {
// declare the ledPinas an OUTPUT:
Serial.begin(9600);
lcd.begin(16, 2);
delay(2000);
}
void loop() {
// read the value from the sensor:
sensorValue= analogRead(sensorPin);
Serial.print("ADC reading is: ");
Serial.println(sensorValue);
delay(500);
// turn the ledPinon
if (sensorValue>=700)
{
lcd.setCursor(0,0);
// Print a message to the LCD.
lcd.print("Sensor Value: ");
lcd.setCursor(0,1);
lcd.print(sensorValue);
lcd.print(" ");
}
;}