#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C LCD(0X27, 20,4);
int RLED=2;
int YLED=3;
int PontData=A3;
int PontValue;
void setup() {
// put your setup code here, to run once:
pinMode(RLED,OUTPUT);
pinMode(YLED,OUTPUT);
pinMode(PontData,INPUT);
LCD.init();
LCD.backlight();
LCD.begin(20,4);
LCD.setCursor(5,0);
LCD.print(" PROGRAME");
LCD.setCursor(0,1);
LCD.print("Red LED Status :");
LCD.setCursor(0,2);
LCD.print("Y/W LED Status :");
}
void loop() {
// put your main code here, to run repeatedly:
PontValue=analogRead(PontData);
if(PontValue>800)
{
digitalWrite(RLED, HIGH);
LCD.setCursor(17,1);
LCD.print("ON");
}
if(PontValue<800)
{
digitalWrite(RLED, LOW);
LCD.setCursor(17,1);
LCD.print("OFF");
}
if(PontValue> 200 && PontValue <600)
{
digitalWrite(YLED, HIGH);
LCD.setCursor(17,2);
LCD.print("ON");
}
if (PontValue<200 || PontValue > 400)
{
digitalWrite(YLED, LOW);
LCD.setCursor(17,2);
LCD.print("OFF");
}
}