#include <ArduinoJson.h>
JsonDocument JSON;

void luxRead(){

  int lux = 45;
  JSON["lux"] = lux;

}
void getAHT10(){

  double tempFloat = 31.24;
  double humiFloat = 55.83;

  JSON["temp_humi"]["temp"] = round( tempFloat * 10) / 10.0;
  JSON["temp_humi"]["humi"] = round( humiFloat * 10) / 10.0;

}
void getNtp(){

  byte hour = 12;
  byte minute = 35;


  JSON["clock"]["hour"] = hour;
  JSON["clock"]["minute"] = minute;

}

void setup() {

  Serial.begin(115200);
  Serial.println("Hello, ESP32!");


  getNtp();
  luxRead();
  getAHT10();

  byte TENTATIVAS;
  // byte loadingWifi[]={0,1,2,3,4,5,6,3};
  byte loadingWifi[3][6]={{0,1,2,6,5,4},
                          {7,8,9,13,12,11},
                          {15,16,17,21,20,19}};

  while(true){
    for(byte c=0; c<3;c++){
      for(byte l=0; l<6; l++){
        delay(150);
        // pixels.setPixelColor( loadingWifi[c][l], pixels.Color(255, 0, 255) );
        // pixels.setPixelColor( loadingWifi[c][l-1], pixels.Color(0, 0, 0) );
        Serial.print(loadingWifi[c][l]);
      }
      Serial.println();
    }
    TENTATIVAS++;
    if(TENTATIVAS >= 15) ESP.restart();

  }



  
  serializeJson(JSON, Serial);
  Serial.print("\nDoc size:");
  Serial.println(sizeof(JSON));
  delay(5000);
  ESP.restart();

}



void loop() {


}