コード例 #1
0
void display_layout2_print_datetime(Ucglib_ILI9341_18x240x320_HWSPI ucg) {
 if (getClock()){
  SERIAL_OUT.println("Refresh Clock "); 
  ucg.setFontMode(UCG_FONT_MODE_SOLID);
  ucg.setFont(FONT_SMALL);
  ucg.setFontPosTop();
  //NTP
  String dateAndTime = "";
  if (now() != prev2Display) { //update the display only if time has changed
    prev2Display = now();
    //NTP
    ////////////////////////////////////////////////////////////////////////////
    String Time = "";
    String Date = "";
    Time = digitalClockDisplay_simple();
    Date = digitalDataDisplay();
    //ucg.setFont(ucg_font_inr19_mf);
    ucg.setFont(ucg_font_helvB14_hf);
    ucg.setColor(0, 255, 255, 255);       // Bianco
    ucg.setPrintPos(160, 4);
    ucg.print(Date);
    //ucg.setFont(ucg_font_inb21_mr);
    ucg.setFont(ucg_font_helvB18_hf);
    ucg.setPrintPos(260, 4);
    ucg.print(Time);
    SERIAL_OUT.print("New Clock: "); SERIAL_OUT.println(Time);
  }
 }
}
コード例 #2
0
//Stampa l'orologio. La zona B1 è quella in alto a sinistra
void display_layout1_print_B1_datetime(Ucglib_ILI9341_18x240x320_HWSPI ucg) {

  ucg.setFontMode(UCG_FONT_MODE_SOLID);
  ucg.setFont(FONT_SMALL);
  ucg.setFontPosTop();
  //NTP
  String dateAndTime = "";
  if (now() != prevDisplay) { //update the display only if time has changed
    prevDisplay = now();
    ucg.setColor(0, 255, 255, 255);    // Bianco
    dateAndTime = digitalClockDisplay();
    ucg.setPrintPos(5, 5);
    display_layout1_print_DateTime(ucg, dateAndTime);
  }
}