1. 디지털 시계가 움직이지 않고 11:59:50:00 에 멈춰 있습니다.
2. temp 부분에서 string을 사용하는데 제 lcd에는 소숫점이 표시가 되지않습니다 어떻게 해야 소숫점 2번째 자리까지 표시할수있죠?? 코드 부분 첨부 하겠습니다
temp-----------------------------------------------------------------------------------------------------------
void temp_mode()
{
temp_value = analogRead(temp_pin);
temp = 0.488155 * (temp_value - 20);
temp_str = String(temp);
lcd.setCursor(0,1);
lcd.print(" [Temp] ");
lcd.print(temp_str);
lcd.print("C ");
}
clock------------------------------------------------------------------------------------------------------------
void clock_mode()
{
if(sw2_clock_flag == 1)
{
lcd.setCursor(0,0);
lcd.print("[ DigitalClock ]");
}
}
timer------------------------------------------------------------------------------------------------------------
void ms_Plus()
{
ms++;
if(ms = 100)
{
ms = 0;
ss++;
}
if(ss = 60)
{
ss = 0;
mm++;
}
if(mm = 60)
{
mm = 0;
hh++;
}
if(hh = 24)
{
hh = 0;
}
}
void timer_mode()
{
if(timer_flag = 1)
{
attachInterrupt(digitalPinToInterrupt(pulse_pin),ms_Plus,RISING);
}
if(timer_flag = 0)
{
hh = 11;
mm = 59;
ss = 50;
ms = 0;
}
timer_10hh = String(hh/10);
timer_1hh = String(hh%10);
timer_10mm = String(mm/10);
timer_1mm = String(mm%10);
timer_10ss = String(ss/10);
timer_1ss = String(ss%10);
timer_10ms = String(ms/10);
timer_1ms = String(ms%10);
if(sw2_clock_flag == 1)
{
lcd.setCursor(0,1);
if(hh<12)
{
lcd.print("[AM]" + timer_10hh + timer_1hh + ":" + timer_10mm + timer_1mm + ":" + timer_10ss + timer_1ss + ":" + timer_10ms + timer_1ms);
}
if(hh>12)
{
lcd.print("[PM]" + timer_10hh + timer_1hh + ":" + timer_10mm + timer_1mm + ":" + timer_10ss + timer_1ss + ":" + timer_10ms + timer_1ms);
}
}
}