void savebalk()
{
boolean q=0;
  if((hb==hour1)&&( mb==min1)){q=1;}
  hb=hour1;
  mb=min1;
  if(q==0)
 { 
JSONVar boardat;
if(min1<10)
{boardat["Time"] = String(hour1)+":0"+String(min1); 
}
else
{
  boardat["Time"] = String(hour1)+":"+String(min1); 
}
boardat["temperatura"] =String(tbal)+" C";
boardat["humidity"] = String(hbal)+" %";
tempdat = JSON.stringify(boardat);
 Serial.println (tempdat);
   esp_task_wdt_reset();//reset WDT
//JSON { "Time":"11:03", "temperatura":"10.56 C", "humidity":"7,56 %" },
tempdat=tempdat+"\n";

 Serial.println ("name2");
//  String name1="/TEMPUL"+ stryen[stamp.year-2014]+strmen[stamp.month-1]+strden[stamp.day-1];
// Serial.println (name2);
createDir(SD, "/TEMPUL");
String name1="/TEMPUL"+ String(stryen[stamp.year-2014]);//2022
 char Buf[50];
 name1.toCharArray(Buf, 50);
 Serial.println (Buf);
createDir(SD, Buf);
 name1=name1+String(strmen[stamp.month-1]);//FEB
 name1.toCharArray(Buf, 50);
  Serial.println (Buf);
 createDir(SD, Buf);
 name1=name1+String(strden[stamp.day-1]);//27
 name1.toCharArray(Buf, 50);
  Serial.println (Buf);
 createDir(SD, Buf);

 name1=name1+String(strdaten[2]);//
 name1.toCharArray(Buf, 50);
//createDir(SD, "/TEMPUL/2022/FEB/27");
// name1="/TEMPUL"+ String(stryen[stamp.year-2014])+String(strmen[stamp.month-1])+String(strden[stamp.day-1])+String(strdaten[0]);
 Serial.println (Buf);
appendFile(SD,Buf,tempdat.c_str());//добавление на инфы в файл
 }
}
//*************************K2*****************************************************************


void savek2()
{
 
JSONVar boardat;
if(min1<10)
{boardat["Time"] = String(hour1)+":0"+String(min1); 
}
else
{
  boardat["Time"] = String(hour1)+":"+String(min1); 
}
boardat["temperatura"] =String(tkom2)+" C";
boardat["humidity"] = String(hkom2)+" %";
tempdat = JSON.stringify(boardat);
 Serial.println (tempdat);
   esp_task_wdt_reset();//reset WDT
//JSON { "Time":"11:03", "temperatura":"10.56 C", "humidity":"7,56 %" },
tempdat=tempdat+"\n";

 Serial.println ("name2");
//  String name1="/TEMPUL"+ stryen[stamp.year-2014]+strmen[stamp.month-1]+strden[stamp.day-1];
// Serial.println (name2);
createDir(SD, "/TEMPUL");
String name1="/TEMPUL"+ String(stryen[stamp.year-2014]);//2022
 char Buf[50];
 name1.toCharArray(Buf, 50);
 Serial.println (Buf);
createDir(SD, Buf);
 name1=name1+String(strmen[stamp.month-1]);//FEB
 name1.toCharArray(Buf, 50);
  Serial.println (Buf);
 createDir(SD, Buf);
 name1=name1+String(strden[stamp.day-1]);//27
 name1.toCharArray(Buf, 50);
  Serial.println (Buf);
 createDir(SD, Buf);

 name1=name1+String(strdaten[3]);//
 name1.toCharArray(Buf, 50);
//createDir(SD, "/TEMPUL/2022/FEB/27");
// name1="/TEMPUL"+ String(stryen[stamp.year-2014])+String(strmen[stamp.month-1])+String(strden[stamp.day-1])+String(strdaten[0]);
 Serial.println (Buf);
appendFile(SD,Buf,tempdat.c_str());//добавление на инфы в файл

}

//**************************K1****************************************************************


void savek1()
{
 boolean q=0;
  if((hk==hour1)&&( mk==min1)){q=1;}
  hk=hour1;
  mk=min1;
  if(q==0)
 { 
JSONVar boardat;
if(min1<10)
{boardat["Time"] = String(hour1)+":0"+String(min1); 
}
else
{
  boardat["Time"] = String(hour1)+":"+String(min1); 
}
boardat["temperatura"] =String(tkom1)+" C";
boardat["humidity"] = String(hkom1)+" %";
tempdat = JSON.stringify(boardat);
 Serial.println (tempdat);
   esp_task_wdt_reset();//reset WDT
//JSON { "Time":"11:03", "temperatura":"10.56 C", "humidity":"7,56 %" },
tempdat=tempdat+"\n";

 Serial.println ("name2");
//  String name1="/TEMPUL"+ stryen[stamp.year-2014]+strmen[stamp.month-1]+strden[stamp.day-1];
// Serial.println (name2);
createDir(SD, "/TEMPUL");
String name1="/TEMPUL"+ String(stryen[stamp.year-2014]);//2022
 char Buf[50];
 name1.toCharArray(Buf, 50);
 Serial.println (Buf);
createDir(SD, Buf);
 name1=name1+String(strmen[stamp.month-1]);//FEB
 name1.toCharArray(Buf, 50);
  Serial.println (Buf);
 createDir(SD, Buf);
 name1=name1+String(strden[stamp.day-1]);//27
 name1.toCharArray(Buf, 50);
  Serial.println (Buf);
 createDir(SD, Buf);

 name1=name1+String(strdaten[4]);//
 name1.toCharArray(Buf, 50);
//createDir(SD, "/TEMPUL/2022/FEB/27");
// name1="/TEMPUL"+ String(stryen[stamp.year-2014])+String(strmen[stamp.month-1])+String(strden[stamp.day-1])+String(strdaten[0]);
 Serial.println (Buf);
appendFile(SD,Buf,tempdat.c_str());//добавление на инфы в файл
 }
}


//*********************kor*********************************************************************


void savekor()
{
 boolean q=0;
  if((hkr==hour1)&&( mkr==min1)){q=1;}
  hkr=hour1;
  mkr=min1;
  if(q==0)
 { 
JSONVar boardat;
if(min1<10)
{boardat["Time"] = String(hour1)+":0"+String(min1); 
}
else
{
  boardat["Time"] = String(hour1)+":"+String(min1); 
}
boardat["temperatura"] =String(tkor)+" C";
boardat["humidity"] = String(hkor)+" %";
tempdat = JSON.stringify(boardat);
 Serial.println (tempdat);
   esp_task_wdt_reset();//reset WDT
//JSON { "Time":"11:03", "temperatura":"10.56 C", "humidity":"7,56 %" },
tempdat=tempdat+"\n";

 Serial.println ("name2");
//  String name1="/TEMPUL"+ stryen[stamp.year-2014]+strmen[stamp.month-1]+strden[stamp.day-1];
// Serial.println (name2);
createDir(SD, "/TEMPUL");
String name1="/TEMPUL"+ String(stryen[stamp.year-2014]);//2022
 char Buf[50];
 name1.toCharArray(Buf, 50);
 Serial.println (Buf);
createDir(SD, Buf);
 name1=name1+String(strmen[stamp.month-1]);//FEB
 name1.toCharArray(Buf, 50);
  Serial.println (Buf);
 createDir(SD, Buf);
 name1=name1+String(strden[stamp.day-1]);//27
 name1.toCharArray(Buf, 50);
  Serial.println (Buf);
 createDir(SD, Buf);

 name1=name1+String(strdaten[5]);//
 name1.toCharArray(Buf, 50);
//createDir(SD, "/TEMPUL/2022/FEB/27");
// name1="/TEMPUL"+ String(stryen[stamp.year-2014])+String(strmen[stamp.month-1])+String(strden[stamp.day-1])+String(strdaten[0]);
 Serial.println (Buf);
appendFile(SD,Buf,tempdat.c_str());//добавление на инфы в файл
 }
}
