#include <LiquidCrystal.h>
LiquidCrystal LCD (12,11,10,9,8,7); // pin rs, en, d4, d5, d6, d7
#define led 13
#define an1 A0
float value =0;
float voltage=0;
float resistance=0;
float lux=0;
const float GAMMA = 0.7;
const float RL10 = 50;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
LCD.begin(16,2);
LCD.print("Hellow World");
LCD.setCursor(4,1);
LCD.print("Marko");
delay(2000);
LCD.clear();
pinMode(led, OUTPUT);
pinMode(an1, INPUT);
}
void loop()
{
value= analogRead(an1);
LCD.print(value);
delay(3000);
LCD.clear();
//int analogValue = analogRead(A0);
voltage = value / 1024. * 5;
resistance = 2000 * voltage / (1 - voltage / 5);
lux = pow(RL10 * 1e3 * pow(10, GAMMA) / resistance, (1 / GAMMA));
Serial.print("voltage : ");
Serial.println(voltage);
Serial.print("Resistance : ");
Serial.println(resistance);
Serial.print("LUX : ");
Serial.println(lux);
}
/*
Functions
LiquidCrystal()
begin()
clear()
home()
setCursor()
write()
print()
cursor()
noCursor()
blink()
noBlink()
display()
noDisplay()
scrollDisplayLeft()
scrollDisplayRight()
autoscroll()
noAutoscroll()
leftToRight()
rightToLeft()
createChar()
*/