本文整理匯總了C#中System.Clock.Init方法的典型用法代碼示例。如果您正苦於以下問題:C# Clock.Init方法的具體用法?C# Clock.Init怎麽用?C# Clock.Init使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Clock
的用法示例。
在下文中一共展示了Clock.Init方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Run
public async void Run(IBackgroundTaskInstance taskInstance)
{
_taskInstance = taskInstance;
_deferral = _taskInstance.GetDeferral();
_taskInstance.Canceled += TaskInstance_Canceled;
var gpio = GpioController.GetDefault();
// turn off red en green led
//var red = gpio.OpenPin(35);
//red.Write(GpioPinValue.Low);
//red.SetDriveMode(GpioPinDriveMode.Output);
//var green = gpio.OpenPin(47);
//green.Write(GpioPinValue.Low);
//green.SetDriveMode(GpioPinDriveMode.Output);
// power cycle +3v3 to reset all I2C devices
//_shdn = gpio.OpenPin(5);
//_shdn.Write(GpioPinValue.High);
//_shdn.SetDriveMode(GpioPinDriveMode.Output);
//_shdn.Write(GpioPinValue.Low);
//// wait to discharge all capacitors
//Task.Delay(3000).GetAwaiter().GetResult();
//_shdn.Write(GpioPinValue.High);
_heater = gpio.OpenPin(16);
_heater.Write(GpioPinValue.Low);
_heater.SetDriveMode(GpioPinDriveMode.Output);
_clock = new Clock();
_clock.Start();
await Init();
await _clock.Init();
_bme280 = new BME280();
await _bme280.Init();
//_timer2 = ThreadPoolTimer.CreatePeriodicTimer(Timer_Tick2, TimeSpan.FromMilliseconds(4));
_timer3 = ThreadPoolTimer.CreatePeriodicTimer(Timer_Tick3, TimeSpan.FromMinutes(1));
}