Exemplo n.º 1
0
        public static double GetTimeUntilNextEdge(int pin, int stateToWaitFor)
        {
            _stopWatch.Reset();

            while (GPIO.DigitalRead(pin) != stateToWaitFor)
            {
            }
            ;

            _stopWatch.Start();

            while (GPIO.DigitalRead(pin) == stateToWaitFor)
            {
            }
            ;

            _stopWatch.Stop();

            return(_stopWatch.Elapsed.TotalSeconds);
        }