private void EnableMotor()
 {
     try
     {
         if (motorEnabled)
         {
             xAxisAmp.Disable();
             enableStatusLabel.Text      = "Motor Disable";
             enableStatusLabel.BackColor = Color.Gray;
             motorEnabled = false;
         }
         else
         {
             xAxisAmp.Enable();
             enableStatusLabel.Text      = "Motor Enable";
             enableStatusLabel.BackColor = Color.Green;
             motorEnabled = true;
         }
     }
     catch (Exception ex)
     {
         DisplayErrorPopup("Actuator Motor Error", "Connection error with linear actuator." +
                           " Reconnect to motor.");
     }
 }
Esempio n. 2
0
        private void moveMotor(int speed, int acceleration, int distance)
        {
            double vel, accel, dist;

            // test speed
            vel   = Convert.ToDouble(speed + 10) * 10;
            accel = Convert.ToDouble(acceleration) * 100;
            dist  = Convert.ToDouble(distance) * 10;

            ProfileSettings = xAxisAmp.ProfileSettings; // read profile settings from amp

            //Set the profile type for move
            ProfileSettings.ProfileType = CML_PROFILE_TYPE.PROFILE_TRAP;

            //Set the profile trajectory values
            ProfileSettings.ProfileAccel = accel;
            ProfileSettings.ProfileDecel = accel;
            ProfileSettings.ProfileVel   = vel;

            // Update the amplier's profile settigns
            xAxisAmp.ProfileSettings = ProfileSettings;

            xAxisAmp.Enable();                                          // Enable Motor
            xAxisAmp.MoveAbs(dist);                                     // Execute the move
        }
 private void enableButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (enableButton.Text == "Amp Disable")
         {
             xAxisAmp.Disable();
             enableButton.Text = "Amp Enable";
         }
         else
         {
             xAxisAmp.Enable();
             enableButton.Text = "Amp Disable";
         }
     }
     catch (Exception ex)
     {
         DisplayError(ex);
     }
 }