void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial.println("Hello, ESP32!");
  pinMode(4, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  delay(10); // this speeds up the simulation

  float pot= analogRead(35);
  float volt= (pot/4095)*3.3;
  float NTC= analogRead(26);
  float temp = 1 / (log(1 / (4095. / NTC - 1)) / 3950 + 1.0 / 298.15) - 273.15;
  
  float LDR = analogRead(27);
  float LDRvolt = LDR / 4095. * 3.3;
  float LDRresistance = 2000 * volt / (1 - volt / 5);
  float lux = pow(50 * 1e3 * pow(10, 0.7) / LDRresistance, (1 / 0.7));

 if(temp>=27)
 {
   tone(4,500);
 }

 else
 {
   noTone(4);
 }
  
  //beta value on the board ntc detail
  Serial.print(pot);
  Serial.print("  ");
  Serial.print(temp);
  Serial.print("  ");
  Serial.print(LDR);
  Serial.print("  ");
  Serial.println(lux);
}