Fez Domino & Parrallax Untrasonic Sensor

Seems like my Parrallax Ultrasonic Sensor is not reading properly or my code is wrong.No matter how close or far I put something it always reads 63 with brief intervals of 1 . Does anyone have experience with this device and can shed some light as to if it is broke or what ? Thanks

Here is the output:
Distance in inches: 63
Distance in inches: 1
Distance in inches: 63
Distance in inches: 62
Distance in inches: 63
Distance in inches: 1
Distance in inches: 62
Distance in inches: 1
Distance in inches: 63
Distance in inches: 63
Distance in inches: 63
Distance in inches: 63
Distance in inches: 1
Distance in inches: 63
Distance in inches: 1
Distance in inches: 62
Distance in inches: 63
Distance in inches: 63
Distance in inches: 62

Here is the code.

    public class Program
    {
        private static OutputPort _led_onboard;
        private static ParallaxPing _sensor_ping;               

        public static void Main()
        {
            _setup();
        }

        private static void _setup()
        {
            // Setup Onboard LED
            _led_onboard = new OutputPort((Cpu.Pin)4, true);

            // Ping))) is attached to Digital Pin 0
            _sensor_ping = new ParallaxPing((Cpu.Pin)FEZ_Pin.Digital.Di0);
            _activeate_sensor_ping();
        }


        #region [Setup Ping Ultrasonic Sensor]
        
        /// <summary>
        /// Activates Ping Ultrasonic Sensor and starts measuring distance
        /// </summary>
        private static void _activeate_sensor_ping()
        {
            Thread measureDistance = new Thread(new ThreadStart(_sensor_ping_sense_distance));
            measureDistance.Start();
        }

        /// <summary>
        /// Thread that continuosly measures distance using 
        /// Ping Ultrasonic Sensor
        /// </summary>
        private static void _sensor_ping_sense_distance()
        {
            while (true)
            {
                Thread.Sleep(1000);

                int distance = _sensor_ping.GetDistance(ParallaxPing.DistanceUnits.Inches);
                Debug.Print("Distance in inches: " + distance.ToString());

            }
        }
        
        #endregion

    }

I would have thought it needed an analog pin not digital?

Add

Thread.Sleep(Timeout.Infinite);

after you call _setup at the end of your Main method.

Ok i got it working. The problem was the gounding between the Fez and the circuit used by the Ping was wrong. Once I get that straight the Ping started measuring correctly. Thanks for you help.

I see. That explains it.