forked from nanoframework/Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
34 lines (26 loc) · 862 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//
// Copyright (c) .NET Foundation and Contributors
// See LICENSE file in the project root for full license information.
//
using System;
using System.Diagnostics;
using System.Threading;
using STM32 = nanoFramework.Hardware.Stm32;
namespace Stm32.TestAlarms
{
public class Program
{
public static void Main()
{
DateTime alarmTime = new DateTime(2018, 10, 29, 23, 30, 15);
Debug.WriteLine($"Set alarm time to {alarmTime.ToString("u")}");
STM32.RTC.SetAlarm(alarmTime);
// wait a couple of seconds...
Thread.Sleep(2000);
// read back alarm time
DateTime alarmTimeReadBack = STM32.RTC.GetAlarm();
Debug.WriteLine($"Alarm was set to {alarmTimeReadBack.ToString("u")}");
Thread.Sleep(Timeout.Infinite);
}
}
}