Example #1
0
        private async Task SendPulse(double milliseconds)
        {
            _hat.WriteDigital(FEZHAT.DigitalPin.DIO26, true); // trigger
            await Task.Delay(TimeSpan.FromMilliseconds(milliseconds));

            _hat.WriteDigital(FEZHAT.DigitalPin.DIO26, false); // trigger
        }
Example #2
0
        //private bool _complete;

        public UltrasonicDistanceSensor(FEZHAT hat)
        {
            _stopwatch        = new Stopwatch();
            _ticks_per_second = Stopwatch.Frequency;
            _tick_resolution  = (long)(RESOLUTION_cm * _ticks_per_second / SPEED_OF_SOUND_cmps * 2.0);
            _hat = hat;
            _hat.WriteDigital(FEZHAT.DigitalPin.DIO26, false); // clear trigger
        }