Beispiel #1
0
        private void btStart2_Click(object sender, EventArgs e)
        {
            if (FMotor2 == null)
            {
                MessageBox.Show("Device is not attached");
            }
            else
            {
                wclWeDoMotorDirection Dir;
                switch (cbDirection2.SelectedIndex)
                {
                case 0:
                    Dir = wclWeDoMotorDirection.mdRight;
                    break;

                case 1:
                    Dir = wclWeDoMotorDirection.mdLeft;
                    break;

                default:
                    Dir = wclWeDoMotorDirection.mdUnknown;
                    break;
                }
                Int32 Res = FMotor2.Run(Dir, Convert.ToByte(edPower2.Text));
                if (Res != wclErrors.WCL_E_SUCCESS)
                {
                    MessageBox.Show("Start motor failed: 0x" + Res.ToString("X8"));
                }
            }
        }
Beispiel #2
0
        private void StartMotor(Byte Port, ComboBox Direction, TextBox Power)
        {
            wclWeDoMotor Motor = GetMotor(Port);

            if (Motor != null)
            {
                wclWeDoMotorDirection Dir;
                switch (Direction.SelectedIndex)
                {
                case 0:
                    Dir = wclWeDoMotorDirection.mdRight;
                    break;

                case 1:
                    Dir = wclWeDoMotorDirection.mdLeft;
                    break;

                default:
                    Dir = wclWeDoMotorDirection.mdUnknown;
                    break;
                }
                Int32 Res = Motor.Run(Dir, Convert.ToByte(Power.Text));
                if (Res != wclErrors.WCL_E_SUCCESS)
                {
                    MessageBox.Show("Start motor failed: 0x" + Res.ToString("X8"));
                }
            }
        }