static void Main(string[] args)
        {
            Console.WriteLine("\nGrove I2C A/D Converter Test\n");

            if (args.Length != 1)
            {
                Console.WriteLine("Usage: test_grove_i2c_adc <bus>\n");
                Environment.Exit(1);
            }

            IO.Interfaces.I2C.Bus bus =
                new IO.Objects.libsimpleio.I2C.Bus(args[0]);

            IO.Interfaces.ADC.Sample adc =
                new IO.Devices.ADC121C021.Sample(bus, 0x50);

            IO.Interfaces.ADC.Input inp =
                new IO.Interfaces.ADC.Input(adc, 3.0, 0.5);

            Console.WriteLine("Resolution: " + adc.resolution.ToString() + " bits\n");

            for (;;)
            {
                Console.WriteLine("Voltage => " + inp.voltage.ToString("F2"));
                Thread.Sleep(1000);
            }
        }
        static void Main(string[] args)
        {
            Console.WriteLine("\nGrove I2C A/D Converter Test\n");

            IO.Interfaces.Message64.Messenger m =
                new IO.Objects.libsimpleio.HID.Messenger();

            IO.Remote.Device dev = new IO.Remote.Device(m);

            IO.Interfaces.I2C.Bus bus =
                new IO.Remote.I2C(dev, 0);

            IO.Interfaces.ADC.Sample adc =
                new IO.Devices.ADC121C021.Sample(bus, 0x50);

            IO.Interfaces.ADC.Input inp =
                new IO.Interfaces.ADC.Input(adc, 3.0, 0.5);

            Console.WriteLine("Resolution: " + adc.resolution.ToString() + " bits\n");

            for (;;)
            {
                Console.WriteLine("Voltage => " + inp.voltage.ToString("F2"));
                Thread.Sleep(1000);
            }
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nRemote I/O ADC121C021 A/D Converter Test\n");

            IO.Remote.Device remdev = new IO.Remote.Device();

            IO.Interfaces.I2C.Bus bus =
                new IO.Remote.I2C(remdev, 0);

            IO.Devices.ADC121C021.Sample ain =
                new IO.Devices.ADC121C021.Sample(bus, 0x50);

            Console.WriteLine("Resolution => " + ain.resolution.ToString());
            Console.WriteLine();

            for (;;)
            {
                Console.WriteLine("Sample => " + ain.sample.ToString());
                System.Threading.Thread.Sleep(1000);
            }
        }