示例#1
0
        public static void Main()
        {
            DateTime rtc = new DateTime(2019, 03, 27, 11, 0, 0);
            Button   btn = new Button(new InputPort(GHICard.Socket12.Pin3, true, Port.ResistorMode.Disabled));

            while (true)
            {
                if (btn.isPressed())
                {
                    GHIRTC.SetDateTime(rtc);
                }

                try
                {
                    Debug.Print("RTC: " + GHIRTC.GetDateTime().ToString());
                }
                catch
                {
                    Debug.Print("RTC NOT SET");
                }
            }
        }
示例#2
0
        public static void Main()
        {
            const string DATE_FORMAT = "dd.MM.yyyy";
            const string HOUR_FORMAT = "HH:mm:ss";

            Thread.Sleep(40);
            Utility.SetLocalTime(GHIRTC.GetDateTime());
            LCD lcd = new LCD();

            string date = "";
            string hour = "";

            while (true)
            {
                date = DateTime.Now.ToString(DATE_FORMAT);
                hour = DateTime.Now.ToString(HOUR_FORMAT);

                lcd.SetCursor(0, 0);
                lcd.Write(date);
                lcd.SetCursor(1, 0);
                lcd.Write(hour);
            }
        }