예제 #1
0
        void Initialize()
        {
            Console.WriteLine("Initialize hardware...");

            // enable the watchdog for 10s
            MeadowOS.WatchdogEnable(10000);
            StartPettingWatchdog(9000);
        }
예제 #2
0
        /// <summary>
        /// Starts up a thread that resets the watchdog at the specified interval.
        /// </summary>
        /// <param name="pettingInterval"></param>
        void StartPettingWatchdog(int pettingInterval)
        {
            // just for good measure, let's reset the watchdog to begin with
            MeadowOS.WatchdogReset();
            // start a thread that pets it
            Thread t = new Thread(() => {
                while (true)
                {
                    Thread.Sleep(pettingInterval);
                    Console.WriteLine("Petting watchdog.");
                    MeadowOS.WatchdogReset();
                }
            });

            t.Start();
        }
        public MeadowApp()
        {
            Initialize();

            onboardLed.SetColor(WildernessLabsColors.PearGreen);
            Thread.Sleep(1000);

            Task.Run(() => {
                MeadowOS.BeginInvokeOnMainThread(
                    () => {
                    for (int i = 0; i < 10; i++)
                    {
                        onboardLed.SetColor(WildernessLabsColors.AzureBlue);
                        Thread.Sleep(1000);
                        onboardLed.SetColor(WildernessLabsColors.ChileanFire);
                        Thread.Sleep(1000);
                    }
                });
            });
        }