Exemplo n.º 1
0
        public void Regulate(Thermometer thermometer, Heater heater, double minTemp, double maxTemp)
        {
            while (true)
            {
                while (thermometer.Read() > minTemp)
                {
                    FakeUtils.Wait(1);
                }
                heater.Engage();

                while (thermometer.Read() < maxTemp)
                {
                    FakeUtils.Wait(1);
                }
                heater.Disengage();
            }
        }
Exemplo n.º 2
0
        public void Regulate(Thermometer t, Heater h, double minTemp, double maxTemp)
        {
            for (; ;)
            {
                while (t.Read() > minTemp)
                {
                    Wait(1);
                }

                // Heat up
                h.Engage();

                while (t.Read() < maxTemp)
                {
                    Wait(1);
                }

                // Cool down
                h.Disengage();
            }
        }