Exemple #1
0
        // TempTimer
        void TempTimer_Tick(GT.Timer timer)
        {
            P1 = (int)(Potentiometer.ReadPotentiometerPercentage() * 100) + 180;
            Debug.Print("Potentiometer: " + P1);

            if (P1 != P2)
            {
                var D3 = (P1 / 100) % 10;
                var D2 = (P1 / 10) % 10;
                var D1 = (P1 / 1) % 10;
                SelectDigit1(D3);
                SelectDigit2(D2);
            }
            else
            {
                // var T1 = Thermocouple.GetInternalTemp_Celsius();
                var T2 = Thermocouple.GetExternalTemp_Celsius();
                Debug.Print("External: " + T2);

                var D3 = (T2 / 100) % 10;
                var D2 = (T2 / 10) % 10;
                var D1 = (T2 / 1) % 10;
                SelectDigit1(D3);
                SelectDigit2(D2);

                // Temperature Control
                if (T2 < P1 - HIST && !RelayStopTimer.IsRunning)
                {
                    Relay.EnableRelay(2);
                    Relay.EnableRelay(4);
                    RelayStartTimer.Start();
                }
                if (T2 > P1 + HIST)
                {
                    Relay.DisableRelay(2);
                    Relay.DisableRelay(4);
                }
            }


            P2 = P1;
        }