Exemple #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nADC Input Test using libsimpleio\n");

            Console.Write("ADC chip:       ");
            int chip = int.Parse(Console.ReadLine());

            Console.Write("ADC channel:    ");
            int channel = int.Parse(Console.ReadLine());

            Console.Write("ADC resolution: ");
            int resolution = int.Parse(Console.ReadLine());

            // Create ADC input object

            IO.Interfaces.ADC.Sample ADC0 =
                new IO.Objects.libsimpleio.ADC.Sample(chip, channel, resolution);

            // Sample ADC input

            Console.WriteLine("\nPress CONTROL-C to exit\n");

            for (;;)
            {
                Console.WriteLine("Sample: " + ADC0.sample.ToString());
                System.Threading.Thread.Sleep(1000);
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nmikroBUS Analog Input Test\n");

            // Get mikroBUS socket number

            Console.Write("Socket number? ");
            var num = int.Parse(Console.ReadLine());

            // Create objects

            var S   = new IO.Objects.libsimpleio.mikroBUS.Socket(num);
            var AIN = new IO.Objects.libsimpleio.ADC.Sample(S.AIN, 32);

            // Display analog input samples

            for (;;)
            {
                Console.WriteLine("Sample => " + AIN.sample.ToString());
                System.Threading.Thread.Sleep(1000);
            }
        }
Exemple #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nRemote I/O Grove Temperature Sensor (thermistor) Test\n");

            // Get ADC hardware parameters

            IO.Objects.libsimpleio.Device.Designator desg;

            Console.Write("ADC chip:       ");
            desg.chip = uint.Parse(Console.ReadLine());

            Console.Write("ADC channel:    ");
            desg.chan = uint.Parse(Console.ReadLine());

            Console.Write("ADC resolution: ");
            int resolution = int.Parse(Console.ReadLine());

            Console.Write("ADC reference:  ");
            double reference = double.Parse(Console.ReadLine());

            Console.WriteLine();

            // Create objects

            IO.Interfaces.ADC.Sample S =
                new IO.Objects.libsimpleio.ADC.Sample(desg, resolution);

            IO.Interfaces.ADC.Input V = new IO.Interfaces.ADC.Input(S, reference);

            IO.Devices.Grove.Temperature.Device T =
                new IO.Devices.Grove.Temperature.Device(V);

            for (;;)
            {
                Console.WriteLine("Temperature => " + T.Celsius.ToString("F2"));
                System.Threading.Thread.Sleep(1000);
            }
        }