Exemple #1
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public BrushedDCMotor(string serialNo)
 {
     serialNumber = serialNo;
     TryToReconnect();                               // Try to connect to the device to check if it exists
     motor.resume();                                 //
     motor.setSpeed((short)CONSTANTS.MAX_SPEED);     // Set the speed and direction using the constants
 }
Exemple #2
0
 /// <summary>
 /// This function runs when the user clicks the Reverse button.
 /// </summary>
 void reverseButton_Click(object sender, EventArgs e)
 {
     try
     {
         using (Smc device = connectToDevice()) // Find a device and temporarily connect.
         {
             device.resume();                   // Clear as many errors as possible.
             device.setSpeed(-3200);            // Set the speed to full reverse (-100%).
         }
     }
     catch (Exception exception)  // Handle exceptions by displaying them to the user.
     {
         displayException(exception);
     }
 }
Exemple #3
0
 public void setSpeedRight(Smc device, short speed)
 {
     try
     {
         // Find a device and temporarily connect.
         {
             device.resume();         // Clear as many errors as possible.
             device.setSpeed(speed);  // Set the speed to full forward (+100%).
         }
     }
     catch (Exception exception)  // Handle exceptions by displaying them to the user.
     {
         Console.WriteLine(exception.Message);
         device.stop();
     }
 }
Exemple #4
0
        public void resume(List <DeviceListItem> deviceList)
        {
            try
            {
                // Find a device and temporarily connect.
                foreach (var dev in deviceList)
                {
                    Smc device = new Smc(dev);

                    device.setSpeed(50);
                    device.resume();
                }
            }
            catch (Exception error)   // Handle exceptions by displaying them to the user.
            {
                Console.WriteLine(error.Message);
            }
        }
Exemple #5
0
 public static void resume(Smc device)
 {
     device.resume();
 }
Exemple #6
0
 public static void resume(Smc device)
 {
     device.resume();
 }