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; } } } }
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; } } } }
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; } } } }
static void Main(string[] args) { Console.WriteLine("\nUSB HID Remote I/O Device Information Query Test\n"); IO.Objects.USB.HID.Messenger m = new IO.Objects.USB.HID.Messenger(); IO.Remote.Device dev = new IO.Remote.Device(m); // Display some device information Console.WriteLine(m.Info); Console.WriteLine(dev.Version); Console.WriteLine(dev.Capabilities); Console.WriteLine(); // Display the available ADC inputs Console.Write("ADC inputs: "); foreach (int input in dev.ADC_Available()) { Console.Write(input.ToString() + " "); } Console.WriteLine(); // Display the available DAC outputs Console.Write("DAC outputs: "); foreach (int input in dev.DAC_Available()) { Console.Write(input.ToString() + " "); } Console.WriteLine(); // Display the available GPIO pins Console.Write("GPIO Pins: "); foreach (int pin in dev.GPIO_Available()) { Console.Write(pin.ToString() + " "); } Console.WriteLine(); // Display the available I2C buses Console.Write("I2C buses: "); foreach (int bus in dev.I2C_Available()) { Console.Write(bus.ToString() + " "); } Console.WriteLine(); // Display the available PWM outputs Console.Write("PWM outputs: "); foreach (int bus in dev.PWM_Available()) { Console.Write(bus.ToString() + " "); } Console.WriteLine(); // Display the available SPI devices Console.Write("SPI devices: "); foreach (int bus in dev.SPI_Available()) { Console.Write(bus.ToString() + " "); } Console.WriteLine(); }
static void Main(string[] args) { Console.WriteLine("\nUDP Remote I/O Device Information Query Test\n"); if (args.Length != 1) { Console.WriteLine("Usage: test_query_udp <hostname>"); Environment.Exit(1); } IO.Interfaces.Message64.Messenger m = new IO.Objects.Message64.UDP.Messenger(args[0], 8087); var remdev = new IO.Remote.Device(m); Console.WriteLine(remdev.Version); Console.WriteLine(remdev.Capabilities); Console.WriteLine(); // Display the available ADC inputs Console.Write("ADC inputs: "); foreach (int input in remdev.ADC_Available()) { Console.Write(input.ToString() + " "); } Console.WriteLine(); // Display the available DAC outputs Console.Write("DAC outputs: "); foreach (int output in remdev.DAC_Available()) { Console.Write(output.ToString() + " "); } Console.WriteLine(); // Display the available GPIO pins Console.Write("GPIO Pins: "); foreach (int pin in remdev.GPIO_Available()) { Console.Write(pin.ToString() + " "); } Console.WriteLine(); // Display the available I2C buses Console.Write("I2C buses: "); foreach (int bus in remdev.I2C_Available()) { Console.Write(bus.ToString() + " "); } Console.WriteLine(); // Display the available PWM outputs Console.Write("PWM outputs: "); foreach (int bus in remdev.PWM_Available()) { Console.Write(bus.ToString() + " "); } Console.WriteLine(); // Display the available SPI devices Console.Write("SPI devices: "); foreach (int bus in remdev.SPI_Available()) { Console.Write(bus.ToString() + " "); } Console.WriteLine(); }