#define digital_In 13
#define analog_In 12

const float GAMMA = 0.7;
const float RL10 = 50;

void setup() {
  Serial.begin(115200);
  pinMode(digital_In, INPUT);
  pinMode(analog_In, INPUT);
}

void loop() {
//Analog: Convert the analog value into lux value:
  int analogValue = analogRead(analog_In);
  float voltage = analogValue / 4096. * 5;
  float resistance = 2000 * voltage / (1 - voltage / 5);
  float lux_a = pow(RL10 * 1e3 * pow(10, GAMMA) / resistance, (1 / GAMMA));
  Serial.print("Analog: Lux");
  Serial.println(lux_a);

//Digital: Threshold light intensity: 100lux
  int lux_d = digitalRead(digital_In);
  if (lux_d == 0){
    Serial.println("Digital: Light");
  }else  {
    Serial.println("Digital: Dark");
  }
  delay(3000);
}