예제 #1
0
 public Servo(ref Arduino myArduino, int Digital_Pin, int MaxAngle = 180, int MinAngle = 0)
 {
     this.Angle = 90;
     this.myArduino = myArduino;
     this.Digital_Pin = Digital_Pin;
     this.myArduino.ServoAttach(Digital_Pin);
     this.MaxAngle = MaxAngle;
     this.MinAngle = MinAngle;
 }
예제 #2
0
파일: Base.cs 프로젝트: JonHoy/Robotic_Arm
        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();
        }
예제 #3
0
        protected Arduino myArduino; // the arduino that is hooked up to the sensor

        #endregion Fields

        #region Constructors

        public Sensor(Arduino Board, int Pin)
        {
            this.myArduino = Board;
            this.analogPin = Pin;
        }
예제 #4
0
 public ResistiveForce(Arduino Board, int Pin)
     : base(Board, Pin)
 {
 }
예제 #5
0
 public SharpIR(Arduino Board, int Pin)
     : base(Board, Pin)
 {
 }