static void Main(string[] args) { Console.WriteLine("\nContinuous Rotation Servo Test\n"); IO.Objects.libsimpleio.Device.Designator desg_PWM; Console.Write("PWM chip: "); desg_PWM.chip = uint.Parse(Console.ReadLine()); Console.Write("PWM channel: "); desg_PWM.chan = uint.Parse(Console.ReadLine()); // Create servo object IO.Interfaces.Servo.Output Servo0 = new IO.Objects.libsimpleio.Servo.Output(desg_PWM, 50); // Create motor object IO.Interfaces.Motor.Output Motor0 = new IO.Objects.Motor.Servo.Output(Servo0); // Sweep motor velocity up and down Console.WriteLine("\nPress CONTROL-C to exit"); for (;;) { int n; for (n = -100; n < 100; n++) { Motor0.velocity = n / 100.0; System.Threading.Thread.Sleep(50); } for (n = 100; n >= -100; n--) { Motor0.velocity = n / 100.0; System.Threading.Thread.Sleep(50); } } }
static void Main(string[] args) { Console.WriteLine("\nServo Output Test\n"); IO.Objects.libsimpleio.Device.Designator desg_PWM; Console.Write("PWM chip: "); desg_PWM.chip = uint.Parse(Console.ReadLine()); Console.Write("PWM channel: "); desg_PWM.chan = uint.Parse(Console.ReadLine()); // Create servo output object IO.Interfaces.Servo.Output Servo0 = new IO.Objects.libsimpleio.Servo.Output(desg_PWM, 50); // Sweep servo position back and forth Console.WriteLine("\nPress CONTROL-C to exit"); for (;;) { int n; for (n = -100; n < 100; n++) { Servo0.position = n / 100.0; System.Threading.Thread.Sleep(50); } for (n = 100; n >= -100; n--) { Servo0.position = n / 100.0; System.Threading.Thread.Sleep(50); } } }
static void Main(string[] args) { Console.WriteLine("\nServo Output Test using libsimpleio\n"); Console.Write("PWM chip: "); int chip = int.Parse(Console.ReadLine()); Console.Write("PWM channel: "); int chan = int.Parse(Console.ReadLine()); // Create servo output object IO.Interfaces.Servo.Output Servo0 = new IO.Objects.libsimpleio.Servo.Output(chip, chan, 50); // Sweep servo position back and forth Console.WriteLine("\nPress CONTROL-C to exit"); for (;;) { int n; for (n = -100; n < 100; n++) { Servo0.position = n / 100.0; Thread.Sleep(50); } for (n = 100; n >= -100; n--) { Servo0.position = n / 100.0; Thread.Sleep(50); } } }