Example #1
0
        public static void Main()
        {
            Debug.WriteLine("Hello from nanoFramework!");
            // var accelStepper = new AccelStepper(AccelStepper.MotorInterfaceType.FULL4WIRE, IN1, IN3, IN2, IN4, false);
            var accelStepper = new AccelStepper(AccelStepper.MotorInterfaceType.FULL4WIRE, IN1, IN3, IN2, IN4, false, new GetMicroSecondsHandler(GetMicroSeconds));

            accelStepper.SetMaxSpeed(400.0f);
            accelStepper.SetAcceleration(100.0f);
            accelStepper.MoveTo(-4069);
            accelStepper.EnableOutputs();

            while (true)
            {
                // Change direction at the limits
                if (accelStepper.DistanceToGo() == 0)
                {
                    accelStepper.MoveTo(-accelStepper.CurrentPosition());
                }
                accelStepper.Run();
            }
        }
Example #2
0
 public void MoveToOffset(Point offset)
 {
     StepperX.MoveTo((long)offset.X);
     StepperY.MoveTo((long)offset.Y);
 }