Esempio n. 1
0
        public static void PollingSenario()
        {
            MAX31865_Instance.SetConvToManual();

            var i            = 0;
            var settlingTime = 10; //10ms

            Debug.WriteLine("PRT Data:");

            for ( ; ;)
            {
                //ExecuteOneshot(); could be used, but more accurate results can be acheived by allowing the sensor to settle through multiple polls.
                MAX31865_Instance.SetConvToAuto();
                Thread.Sleep(settlingTime);
                MAX31865_Instance.SetConvToManual();

                //note: on startup the sensor can show -248 before it has been initialised properly ?! if the ADC is not attached it will read more 855
                //    if (temperature > -150 && temperature < 150)
                Debug.WriteLine($"Fault Status: {GetFaultStatus()}, config: {GetCurrentConfig()}");
                // note: reading a sensor past their default accuracy is not really helpful, for production, it would would be wise to use something like:
                //    var trunkatedTemp = System.Math.Truncate((GetTemperature() * 100) / 100);
                Debug.WriteLine($"{i++}: temperature: {GetTemperature()}, resistance: {GetResistance()}");

                Thread.Sleep(15000 - settlingTime); //15 seconds is about right to stop self heating from occuring on the sensor
            }
        }