Beispiel #1
0
        /// <summary>
        /// Constructor for a single Expand click.
        /// </summary>
        /// <param name="socknum">mikroBUS socket number.</param>
        /// <param name="remdev">Remote I/O server device object.</param>
        public Board(int socknum, IO.Remote.Device remdev = null)
        {
            // Create Remote I/O server device object, if one wasn't supplied

            if (remdev == null)
            {
                remdev = new IO.Remote.Device();
            }

            // Create a mikroBUS socket object

            IO.Remote.mikroBUS.Socket S =
                new IO.Remote.mikroBUS.Socket(socknum);

            // Configure hardware reset GPIO pin

            myrst = remdev.GPIO_Create(S.RST,
                                       IO.Interfaces.GPIO.Direction.Output, true);

            // Issue hardware reset

            Reset();

            // Create MCP23S17 device object

            mydev = new IO.Devices.MCP23S17.Device(remdev.SPI_Create(S.SPIDev,
                                                                     IO.Devices.MCP23S17.Device.SPI_Mode,
                                                                     IO.Devices.MCP23S17.Device.SPI_WordSize,
                                                                     IO.Devices.MCP23S17.Device.SPI_Frequency));
        }
        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
        /// <summary>
        /// Constructor for a single PWM click.
        /// </summary>
        /// <param name="socknum">mikroBUS socket number.</param>
        /// <param name="freq">PWM pulse frequency in Hz.</param>
        /// <param name="addr">I<sup>2</sup>C slave address.</param>
        /// <param name="remdev">Remote I/O device object.</param>
        public Board(int socknum, int freq, int addr = DefaultAddress,
                     IO.Remote.Device remdev         = null)
        {
            // Create Remote I/O server device object, if one wasn't supplied

            if (remdev == null)
            {
                remdev = new IO.Remote.Device();
            }

            // Create a mikroBUS socket object

            IO.Remote.mikroBUS.Socket S =
                new IO.Remote.mikroBUS.Socket(socknum);

            IO.Interfaces.I2C.Bus bus;

            if (IO.Remote.mikroBUS.Shield.I2CBus is null)
            {
                bus = remdev.I2C_Create(S.I2CBus);
            }
            else
            {
                bus = IO.Remote.mikroBUS.Shield.I2CBus;
            }

            mydev = new IO.Devices.PCA9685.Device(bus, addr, freq);
        }
Beispiel #4
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);
            }
        }
Beispiel #5
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);
            }
        }
Beispiel #6
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 socket = new IO.Remote.mikroBUS.Socket(num);
            var remdev = new IO.Remote.Device();

            IO.Interfaces.ADC.Sample AIN = remdev.ADC_Create(socket.AIN);

            Console.WriteLine("\nADC Resolution => " + AIN.resolution.ToString() +
                              " bits\n");

            // Display analog input samples

            for (;;)
            {
                Console.WriteLine("Sample => " + AIN.sample.ToString());
                System.Threading.Thread.Sleep(1000);
            }
        }
Beispiel #7
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nGPIO Pin Toggle Test\n");

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

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

            // Create GPIO pin object

            Console.Write("GPIO channel number? ");

            IO.Interfaces.GPIO.Pin Output =
                new IO.Remote.GPIO(dev, int.Parse(Console.ReadLine()),
                                   IO.Interfaces.GPIO.Direction.Output);

            // Toggle the GPIO output

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

            for (;;)
            {
                Output.state = !Output.state;
            }
        }
Beispiel #8
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);
            }
        }
Beispiel #9
0
        public static Int32 Main(string[] args)
        {
            Console.WriteLine("\nRemote I/O Protocol Client\n");

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

            Console.WriteLine(dev.Version);
            Console.WriteLine(dev.Capabilities);

            return(0);
        }
Beispiel #10
0
        /// <summary>
        /// Constructor for a single 7seg click.
        /// </summary>
        /// <param name="socket">mikroBUS socket number.</param>
        /// <param name="radix">Numerical base or radix.  Allowed values are
        /// <c>Decimal</c> and <c>Hexadecimal</c>.</param>
        /// <param name="blanking">Zero blanking.  Allowed values are
        /// <c>None</c>, <c>Leading</c>, and <c>Full</c>.</param>
        /// <param name="pwmfreq">PWM frequency.  Set to zero to use GPIO
        /// instead of PWM.</param>
        /// <param name="remdev">Remote I/O server device object.</param>
        public Board(int socket, Base radix  = Base.Decimal,
                     ZeroBlanking blanking   = ZeroBlanking.None, int pwmfreq = 100,
                     IO.Remote.Device remdev = null)
        {
            // Create Remote I/O server device object, if one wasn't supplied

            if (remdev == null)
            {
                remdev = new IO.Remote.Device();
            }

            // Create a mikroBUS socket object

            IO.Remote.mikroBUS.Socket S =
                new IO.Remote.mikroBUS.Socket(socket);

            // Configure hardware reset GPIO pin

            myRSTgpio = remdev.GPIO_Create(S.RST,
                                           IO.Interfaces.GPIO.Direction.Output, true);

            // Issue hardware reset

            Reset();

            // Configure PWM pin -- Prefer PWM over GPIO, if possible, and
            // assume full brightness until otherwise changed.

            myPWMgpio = null;
            myPWMout  = null;

            if ((pwmfreq > 0) && (S.PWMOut != IO.Remote.Device.Unavailable))
            {
                myPWMout = remdev.PWM_Create(S.PWMOut, pwmfreq, 100.0);
            }
            else if (S.PWM != IO.Remote.Device.Unavailable)
            {
                myPWMgpio = remdev.GPIO_Create(S.PWM,
                                               IO.Interfaces.GPIO.Direction.Output, true);
            }

            // Configure 74HC595 shift register chain

            mychain = new SN74HC595.Device(remdev.SPI_Create(S.SPIDev,
                                                             IO.Devices.SN74HC595.Device.SPI_Mode, 8,
                                                             IO.Devices.SN74HC595.Device.SPI_MaxFreq), 2);

            myradix    = radix;
            myblanking = blanking;
            Clear();
        }
Beispiel #11
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nLED Toggle Test\n");

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

            IO.Interfaces.GPIO.Pin LED = dev.GPIO_Create(0, IO.Interfaces.GPIO.Direction.Output);

            for (;;)
            {
                LED.state = !LED.state;
                Thread.Sleep(500);
            }
        }
Beispiel #12
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nRemote I/O LED Toggle Test\n");

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

            IO.Interfaces.GPIO.Pin LED =
                remdev.GPIO_Create(0, IO.Interfaces.GPIO.Direction.Output);

            for (;;)
            {
                LED.state = !LED.state;
                System.Threading.Thread.Sleep(500);
            }
        }
Beispiel #13
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);
            }
        }
Beispiel #14
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nDAC Output Test using libsimpleio\n");

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

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

            Console.Write("Channels:    ");

            foreach (int output in dev.DAC_Available())
            {
                Console.Write(" " + output.ToString());
            }

            Console.WriteLine();

            ArrayList S = new ArrayList();

            foreach (int c in dev.DAC_Available())
            {
                S.Add(new IO.Remote.DAC(dev, c));
            }

            Console.Write("Resolutions: ");

            foreach (IO.Interfaces.DAC.Sample output in S)
            {
                Console.Write(" " + output.resolution.ToString());
            }

            Console.WriteLine();

            for (;;)
            {
                int n;

                for (n = 0; n < 4096; n++)
                {
                    foreach (IO.Interfaces.DAC.Sample output in S)
                    {
                        output.sample = n;
                    }
                }
            }
        }
Beispiel #15
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nUSB HID Remote I/O Button and LED Test\n");

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

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

            // Configure LED output

            IO.Interfaces.GPIO.Pin LD1 =
                new IO.Remote.GPIO(d, 0, IO.Interfaces.GPIO.Direction.Output);

            // Configure button input

            IO.Interfaces.GPIO.Pin SW1 =
                new IO.Remote.GPIO(d, 1, IO.Interfaces.GPIO.Direction.Input);

            bool OldState = !SW1.state;
            bool NewState = OldState;

            // Read the button and write the LED

            for (;;)
            {
                NewState = SW1.state;

                if (NewState != OldState)
                {
                    if (NewState)
                    {
                        Console.WriteLine("PRESSED");
                        LD1.state = true;
                    }
                    else
                    {
                        Console.WriteLine("RELEASED");
                        LD1.state = false;
                    }

                    OldState = NewState;
                }

                System.Threading.Thread.Sleep(100);
            }
        }
Beispiel #16
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nUSB HID Remote I/O Analog Input Test\n");

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

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

            Console.Write("Channels:    ");

            foreach (int input in dev.ADC_Available())
            {
                Console.Write(" " + input.ToString());
            }

            Console.WriteLine();

            ArrayList S = new ArrayList();

            foreach (int c in dev.ADC_Available())
            {
                S.Add(new IO.Remote.ADC(dev, c));
            }

            Console.Write("Resolutions: ");

            foreach (IO.Interfaces.ADC.Sample inp in S)
            {
                Console.Write(" " + inp.resolution.ToString());
            }

            Console.WriteLine();

            for (;;)
            {
                Console.Write("Samples:     ");

                foreach (IO.Interfaces.ADC.Sample inp in S)
                {
                    Console.Write(String.Format(" {0:00000}", inp.sample));
                }

                Console.WriteLine();
                Thread.Sleep(2000);
            }
        }
Beispiel #17
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nPWM Output Test\n");

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

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

            Console.Write("Channels:");

            foreach (int output in dev.PWM_Available())
            {
                Console.Write(" " + output.ToString());
            }

            Console.WriteLine();

            ArrayList S = new ArrayList();

            foreach (int c in dev.PWM_Available())
            {
                S.Add(new IO.Remote.PWM(dev, c, 1000));
            }

            for (;;)
            {
                int n;

                for (n = 0; n < 500; n++)
                {
                    foreach (IO.Interfaces.PWM.Output output in S)
                    {
                        output.dutycycle = n / 5.0;
                    }
                }

                for (n = 500; n >= 0; n--)
                {
                    foreach (IO.Interfaces.PWM.Output output in S)
                    {
                        output.dutycycle = n / 5.0;
                    }
                }
            }
        }
Beispiel #18
0
        /// <summary>
        /// Constructor for a single ADAC click.
        /// </summary>
        /// <param name="socknum">mikroBUS socket number.</param>
        /// <param name="addr">I<sup>2</sup>C slave address.</param>
        /// <param name="remdev">Remote I/O server device object.</param>
        public Board(int socknum, int addr   = DefaultAddress,
                     IO.Remote.Device remdev = null)
        {
            // Create Remote I/O server device object, if one wasn't supplied

            if (remdev == null)
            {
                remdev = new IO.Remote.Device();
            }

            // Create a mikroBUS socket object

            IO.Remote.mikroBUS.Socket S =
                new IO.Remote.mikroBUS.Socket(socknum);

            // Configure hardware reset GPIO pin

            myrst = remdev.GPIO_Create(S.RST,
                                       IO.Interfaces.GPIO.Direction.Output, true);

            // Issue hardware reset

            Reset();

            // Configure I2C bus

            IO.Interfaces.I2C.Bus bus;

            if (IO.Remote.mikroBUS.Shield.I2CBus is null)
            {
                bus = remdev.I2C_Create(S.I2CBus);
            }
            else
            {
                bus = IO.Remote.mikroBUS.Shield.I2CBus;
            }

            // Configure AD5593R

            mydev = new IO.Devices.AD5593R.Device(bus, addr);

            // The ADAC click is wired for 0-5.0V on both ADC and DAC

            mydev.ADC_Reference = IO.Devices.AD5593R.ReferenceMode.Internalx2;
            mydev.DAC_Reference = IO.Devices.AD5593R.ReferenceMode.Internalx2;
        }
Beispiel #19
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nServo Output Test\n");

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

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

            Console.Write("Channels:");

            foreach (int output in dev.PWM_Available())
            {
                Console.Write(" " + output.ToString());
            }

            Console.WriteLine();

            ArrayList S = new ArrayList();

            foreach (int c in dev.PWM_Available())
            {
                S.Add(new IO.Objects.Servo.PWM.Output(new IO.Remote.PWM(dev, c, 50), 50));
            }

            for (;;)
            {
                int n;

                for (n = -300; n <= 300; n++)
                {
                    foreach (IO.Interfaces.Servo.Output output in S)
                    {
                        output.position = n / 300.0;
                    }
                }

                for (n = 300; n >= -300; n--)
                {
                    foreach (IO.Interfaces.Servo.Output output in S)
                    {
                        output.position = n / 300.0;
                    }
                }
            }
        }
Beispiel #20
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nA4988 Stepper Motor Driver Test\n");

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

            // Get the number of descrete steps the motor under test has

            Console.Write("Number of steps?             ");
            int numsteps = int.Parse(Console.ReadLine());

            // Create STEP signal GPIO pin object

            Console.Write("STEP signal GPIO pin number? ");

            IO.Interfaces.GPIO.Pin Step_Pin =
                new IO.Remote.GPIO(remdev, int.Parse(Console.ReadLine()),
                                   IO.Interfaces.GPIO.Direction.Output);

            // Create DIR signal GPIO pin object

            Console.Write("DIR signal GPIO pin number?  ");

            IO.Interfaces.GPIO.Pin Dir_Pin =
                new IO.Remote.GPIO(remdev, int.Parse(Console.ReadLine()),
                                   IO.Interfaces.GPIO.Direction.Output);

            Console.WriteLine();

            // Create A4988 device object

            IO.Interfaces.Stepper.Output outp =
                new IO.Devices.A4988.Device(numsteps, Step_Pin, Dir_Pin);

            for (;;)
            {
                Console.Write("Steps? ");
                int steps = int.Parse(Console.ReadLine());

                Console.Write("Rate?  ");
                float rate = float.Parse(Console.ReadLine());

                outp.Move(steps, rate);
            }
        }
Beispiel #21
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nUSB HID Remote I/O Device LED Test\n");

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

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

            IO.Interfaces.GPIO.Pin LED =
                dev.GPIO_Create(0, IO.Interfaces.GPIO.Direction.Output);

            for (;;)
            {
                LED.state = !LED.state;
                Thread.Sleep(500);
            }
        }
Beispiel #22
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;
            }
        }
Beispiel #23
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);
            }
        }
        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);
            }
        }
Beispiel #25
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nRemote I/O Analog Output Test\n");

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

            Console.Write("Channels:    ");

            foreach (int output in remdev.DAC_Available())
            {
                Console.Write(" " + output.ToString());
            }

            Console.WriteLine();

            ArrayList S = new ArrayList();

            foreach (int c in remdev.DAC_Available())
            {
                S.Add(new IO.Remote.DAC(remdev, c));
            }

            Console.Write("Resolutions: ");

            foreach (IO.Interfaces.DAC.Sample output in S)
            {
                Console.Write(" " + output.resolution.ToString());
            }

            Console.WriteLine();

            for (;;)
            {
                int n;

                for (n = 0; n < 4096; n++)
                {
                    foreach (IO.Interfaces.DAC.Sample output in S)
                    {
                        output.sample = n;
                    }
                }
            }
        }
Beispiel #26
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nRemote I/O GPIO Button and LED Test\n");

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

            // Configure LED output

            IO.Interfaces.GPIO.Pin LD1 =
                new IO.Remote.GPIO(remdev, 0, IO.Interfaces.GPIO.Direction.Output);

            // Configure button input

            IO.Interfaces.GPIO.Pin SW1 =
                new IO.Remote.GPIO(remdev, 1, IO.Interfaces.GPIO.Direction.Input);

            bool OldState = !SW1.state;
            bool NewState = OldState;

            // Read the button and write the LED

            for (;;)
            {
                NewState = SW1.state;

                if (NewState != OldState)
                {
                    if (NewState)
                    {
                        Console.WriteLine("PRESSED");
                        LD1.state = true;
                    }
                    else
                    {
                        Console.WriteLine("RELEASED");
                        LD1.state = false;
                    }

                    OldState = NewState;
                }

                System.Threading.Thread.Sleep(100);
            }
        }
Beispiel #27
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nRemote I/O Analog Input Test\n");

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

            Console.Write("Channels:    ");

            foreach (int input in remdev.ADC_Available())
            {
                Console.Write(" " + input.ToString());
            }

            Console.WriteLine();

            ArrayList S = new ArrayList();

            foreach (int c in remdev.ADC_Available())
            {
                S.Add(new IO.Remote.ADC(remdev, c));
            }

            Console.Write("Resolutions: ");

            foreach (IO.Interfaces.ADC.Sample inp in S)
            {
                Console.Write(" " + inp.resolution.ToString());
            }

            Console.WriteLine();

            for (;;)
            {
                Console.Write("Samples:     ");

                foreach (IO.Interfaces.ADC.Sample inp in S)
                {
                    Console.Write(String.Format(" {0:00000}", inp.sample));
                }

                Console.WriteLine();
                System.Threading.Thread.Sleep(2000);
            }
        }
Beispiel #28
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;
            }
        }
Beispiel #29
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nRemote I/O PWM Output Test\n");

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

            Console.Write("Channels:");

            foreach (int output in remdev.PWM_Available())
            {
                Console.Write(" " + output.ToString());
            }

            Console.WriteLine();

            ArrayList S = new ArrayList();

            foreach (int c in remdev.PWM_Available())
            {
                S.Add(new IO.Remote.PWM(remdev, c, 1000));
            }

            for (;;)
            {
                int n;

                for (n = 0; n < 500; n++)
                {
                    foreach (IO.Interfaces.PWM.Output output in S)
                    {
                        output.dutycycle = n / 5.0;
                    }
                }

                for (n = 500; n >= 0; n--)
                {
                    foreach (IO.Interfaces.PWM.Output output in S)
                    {
                        output.dutycycle = n / 5.0;
                    }
                }
            }
        }
Beispiel #30
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nRemote I/O Grove Temperature Sensor (thermistor) Test\n");

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

            IO.Interfaces.ADC.Sample S = new IO.Remote.ADC(remdev, 0);

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

            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);
            }
        }