Ejemplo n.º 1
0
        public static void Main()
        {
            Thread.Sleep(350);

            var led = new OutputPort(Pins.ONBOARD_LED, false);
            var readIn = new SecretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_A0);

            while (true)
            {
                int readRaw = readIn.Read();
                double anVolt = readRaw * (3.3 / 1024);
                double distance = anVolt / 0.0064453125;

                Debug.Print(distance + " inches");
                SelectivelyLightLed(led, distance);

                Thread.Sleep(3000);
            }
        }
Ejemplo n.º 2
0
 public int Distance()
 {
     return((int)inputPin.Read());
 }