示例#1
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;
            }
        }
示例#2
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);
            }
        }
示例#3
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);
            }
        }
示例#4
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);
            }
        }
示例#5
0
        static void Main(string[] args)
        {
            Console.WriteLine("\nRemote I/O GPIO Pin Toggle Test\n");

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

            // Create GPIO pin object

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

            IO.Interfaces.GPIO.Pin Output =
                new IO.Remote.GPIO(remdev, 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;
            }
        }