public ServoController( Servo myServo, double Sensitivity, double DeadZone, uint StickMapping ) { this.myServo = myServo; this.Sensitivity = Sensitivity; this.DeadZone = DeadZone; this.StickMapping = StickMapping; }
public Base() { var comports = SerialPort.GetPortNames(); if (comports.Length == 0) { throw new Exception("Error: No COM ports found"); } for (int i = 0; i < comports.Length; i++) { try { Mega2560 = new Arduino(comports[i]); break; } catch (Exception) {} } ForceSensor = new ResistiveForce(Mega2560, Force_Analog_Pin); DistanceSensor = new SharpIR(Mega2560, Distance_Analog_Pin); LightSensor = new Sensor(Mega2560, Light_Analog_Pin); Webcam = new Capture(); Dictionary = new SpeechDictionary(); Webcam.SetCaptureProperty(CAP_PROP.CV_CAP_PROP_FRAME_WIDTH, 1280); Webcam.SetCaptureProperty(CAP_PROP.CV_CAP_PROP_FRAME_HEIGHT, 720); // set cam resolution to 720P Webcam.QueryFrame(); // take a test photo Webcam.ImageGrabbed += new EventHandler(Webcam_ImageGrabbed); XboxController = new Controller(UserIndex.One); xAxisServo = new Servo(ref Mega2560, xServoPin); yAxisServo1 = new Servo(ref Mega2560, y1ServoPin, y1ServoMax, y1ServoMin); yAxisServo2 = new Servo(ref Mega2560, y2ServoPin, y2ServoMax, y2ServoMin); gripperServo = new Servo(ref Mega2560, gripServoPin, gripServoMax, gripServoMin); xAxisServo.ServoAngleChange(xServoStart); yAxisServo1.ServoAngleChange(y1ServoStart); yAxisServo2.ServoAngleChange(y2ServoStart); gripperServo.ServoAngleChange(gripServoStart); SpeechEngine = new SpeechRecognition.Base(); }