private static void ShowMainDisplay(DateTime currentTime) { var thesisDueTime = new DateTime(2016, 2, 15, 16, 0, 0); var examStartTime = new DateTime(2016, 2, 22, 8, 30, 0); var examEndTime = new DateTime(2016, 2, 22, 18, 30, 0); using (var lcd = new KanaLCD(0x38, 2, 40)) { if (currentTime.Ticks < thesisDueTime.Ticks) { var leftTime = thesisDueTime - currentTime; lcd.ClearScreen(); lcd.SetCursor(0, 0); lcd.Write("シュウロン テイシュツ マデ"); lcd.SetCursor(1, 0); lcd.Write("アト " + leftTime.Days.ToString() + "d " + leftTime.Hours.To2DigitString() + ":" + leftTime.Minutes.To2DigitString() + ":" + leftTime.Seconds.To2DigitString()); } else if (currentTime.Ticks < examStartTime.Ticks) { var leftTime = examStartTime - currentTime; lcd.ClearScreen(); lcd.SetCursor(0, 0); lcd.Write("シモン カイシ マデ"); lcd.SetCursor(1, 0); lcd.Write("アト " + leftTime.Days.ToString() + "d " + leftTime.Hours.To2DigitString() + ":" + leftTime.Minutes.To2DigitString() + ":" + leftTime.Seconds.To2DigitString()); } else if (currentTime.Ticks < examEndTime.Ticks) { var elapsedTime = currentTime - examStartTime; lcd.ClearScreen(); lcd.SetCursor(0, 0); lcd.Write("シモン カイシ カラ"); lcd.SetCursor(1, 0); lcd.Write(elapsedTime.Hours.To2DigitString() + ":" + elapsedTime.Minutes.To2DigitString() + ":" + elapsedTime.Seconds.To2DigitString() + " ケイカ"); } else { lcd.ClearScreen(); lcd.SetCursor(0, 0); lcd.Write("シモン オツカレサマデシタ!"); lcd.SetCursor(1, 0); lcd.Write(currentTime.Month.To2DigitString() + "/" + currentTime.Day.To2DigitString() + " " + currentTime.Hour.To2DigitString() + ":" + currentTime.Minute.To2DigitString() + ":" + currentTime.Second.To2DigitString()); } } }
private static void ShowAnotherDisplay(DateTime currentTime) { double temperature; using (var thermometer = new ADT7410(ADT7410.MeasurementMode.OneSamplePerSecond)) { temperature = thermometer.ReadTemperature(); } using (var lcd = new KanaLCD(0x38, 2, 40)) { lcd.ClearScreen(); lcd.SetCursor(0, 0); lcd.Write(currentTime.Year.To4DigitString() + "/" + currentTime.Month.To2DigitString() + "/" + currentTime.Day.To2DigitString()); lcd.SetCursor(1, 0); lcd.Write(currentTime.Hour.To2DigitString() + ":" + currentTime.Minute.To2DigitString() + ":" + currentTime.Second.To2DigitString() + " " + ((int)temperature).To2DigitString() + "." + (int)(temperature * 10) % 10 + "°C"); } anotherDisplayCount--; }