#include <Arduino.h>
#include <Wire.h>
#include <SoftwareSerial.h>

double angle_rad = PI/180.0;
double angle_deg = 180.0/PI;
double a, LUX, Rensor;

void setup(){
    a = 0;
    Serial.begin(9600);
    pinMode(14,INPUT);
    pinMode(4,OUTPUT);
}

void loop(){
    a = analogRead(14)/10000);
    Rensor = ((1023 - a) * 10.0 / a);
    LUX = round(10000.0 / pow((Rensor*10.0),(4.0/3.0)));
    Serial.print("Lux :");
  Serial.println(LUX);
    digitalWrite(4,0);
    _loop();
}

void _delay(float seconds){
    long endTime = millis() + seconds * 1000;
    while(millis() < endTime)_loop();
}

void _loop(){
}
