Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nTH02 Temperature/Humidity Sensor Test\n");

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

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

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

            IO.Devices.TH02.Device dev = new IO.Devices.TH02.Device(bus);

            Console.WriteLine("Device ID: 0x" + dev.DeviceID.ToString("X2"));
            Console.WriteLine();

            for (;;)
            {
                Console.Write("Temperature: " + dev.Temperature.ToString("F1"));
                Console.Write("  ");
                Console.Write("Humidity: " + dev.Humidity.ToString("F1"));
                Console.WriteLine();

                System.Threading.Thread.Sleep(1000);
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nHDC1080 Temperature/Humidity Sensor Test\n");

            IO.Remote.Device remdev =
                new IO.Remote.Device(new IO.Objects.USB.HID.Messenger());

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

            IO.Devices.HDC1080.Device dev = new IO.Devices.HDC1080.Device(bus);

            Console.Write("Manufacturer ID: 0x" + dev.ManufacturerID.ToString("X4"));
            Console.Write("  ");
            Console.WriteLine("Device ID: 0x" + dev.DeviceID.ToString("X4"));
            Console.WriteLine();

            for (;;)
            {
                Console.Write("Temperature: " + dev.Temperature.ToString("F1"));
                Console.Write("  ");
                Console.Write("Humidity: " + dev.Humidity.ToString("F1"));
                Console.WriteLine();

                System.Threading.Thread.Sleep(1000);
            }
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nRemote I/O Digilent Pmod-HYGRO Temperature/Humidity Sensor Test\n");

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

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

            IO.Devices.Pmod.HYGRO.Device dev =
                new IO.Devices.Pmod.HYGRO.Device(bus);

            Console.Write("Manufacturer ID: 0x" + dev.ManufacturerID.ToString("X4"));
            Console.Write("  ");
            Console.WriteLine("Device ID: 0x" + dev.DeviceID.ToString("X4"));
            Console.WriteLine();

            for (;;)
            {
                Console.Write("Temperature: " + dev.Celsius.ToString("F1"));
                Console.Write("  ");
                Console.Write("Humidity: " + dev.Humidity.ToString("F1"));
                Console.WriteLine();

                System.Threading.Thread.Sleep(1000);
            }
        }
Exemplo n.º 4
0
        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);
            }
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nRemote I/O PCA8574 GPIO Port Toggle Test\n");

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

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

            IO.Devices.PCA8574.Device dev = new IO.Devices.PCA8574.Device(bus, 0x38);

            for (;;)
            {
                dev.Write(0x55);
                dev.Write(0xAA);
            }
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nRemote I/O PCA8574 GPIO Pin Toggle Test\n");

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

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

            IO.Devices.PCA8574.Device dev = new IO.Devices.PCA8574.Device(bus, 0x38);

            IO.Interfaces.GPIO.Pin GPIO0 = new IO.Devices.PCA8574.GPIO.Pin(dev, 0,
                                                                           IO.Interfaces.GPIO.Direction.Output, false);

            for (;;)
            {
                GPIO0.state = !GPIO0.state;
            }
        }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nRemote I/O Grove ADC Test\n");

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

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

            IO.Devices.Grove.ADC.Device ain =
                new IO.Devices.Grove.ADC.Device(bus);

            for (;;)
            {
                Console.WriteLine("Voltage => " + ain.voltage.ToString("F2"));
                System.Threading.Thread.Sleep(1000);
            }
        }
Exemplo n.º 8
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nPCA9534 GPIO Port Toggle Test\n");

            IO.Remote.Device remdev =
                new IO.Remote.Device(new IO.Objects.USB.HID.Messenger());

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

            IO.Devices.PCA9534.Device dev = new IO.Devices.PCA9534.Device(bus, 0x27,
                                                                          IO.Devices.PCA9534.Device.AllOutputs);

            for (;;)
            {
                dev.Write(0x55);
                dev.Write(0xAA);
            }
        }
Exemplo n.º 9
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nPCA9534 GPIO Pin Toggle Test\n");

            IO.Remote.Device remdev =
                new IO.Remote.Device(new IO.Objects.USB.HID.Messenger());

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

            IO.Devices.PCA9534.Device dev = new IO.Devices.PCA9534.Device(bus, 0x27);

            IO.Interfaces.GPIO.Pin GPIO0 = new IO.Devices.PCA9534.GPIO.Pin(dev, 0,
                                                                           IO.Interfaces.GPIO.Direction.Output, false);

            for (;;)
            {
                GPIO0.state = !GPIO0.state;
            }
        }
Exemplo n.º 10
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nUSB HID Remote I/O PCA8574 GPIO Port Toggle Test\n");

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

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

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

            IO.Devices.PCA8574.Device dev = new IO.Devices.PCA8574.Device(bus, 0x38);

            for (;;)
            {
                dev.Write(0x55);
                dev.Write(0xAA);
            }
        }
Exemplo n.º 11
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);
            }
        }
Exemplo n.º 12
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nUSB HID Remote I/O PCA8574 GPIO Pin Toggle Test\n");

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

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

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

            IO.Devices.PCA8574.Device dev = new IO.Devices.PCA8574.Device(bus, 0x38);

            IO.Interfaces.GPIO.Pin GPIO0 = new IO.Devices.PCA8574.GPIO.Pin(dev, 0,
                                                                           IO.Interfaces.GPIO.Direction.Output, false);

            for (;;)
            {
                GPIO0.state = !GPIO0.state;
            }
        }
Exemplo n.º 13
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nRemote I/O Grove Temperature and Humidity Sensor (TH02) Test\n");

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

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

            IO.Devices.Grove.Temperature_Humidity.Device dev =
                new IO.Devices.Grove.Temperature_Humidity.Device(bus);

            Console.WriteLine("Device ID: 0x" + dev.DeviceID.ToString("X2"));
            Console.WriteLine();

            for (;;)
            {
                Console.Write("Temperature: " + dev.Celsius.ToString("F1"));
                Console.Write("  ");
                Console.Write("Humidity: " + dev.Humidity.ToString("F1"));
                Console.WriteLine();

                System.Threading.Thread.Sleep(1000);
            }
        }