예제 #1
0
        /// <summary>
        /// This is where all sensor and motor properties are initialized
        /// </summary>
        /// <param name="bluetoothPortName"></param>
        public Scorpio(string bluetoothPortName)
        {
            Brick = new AForgeNxtBrickFacade();
            BluetoothPortName = bluetoothPortName;

            // Sensors:
            // 1
            TouchSensor = new TouchSensor(Brick, NxtBrick.Sensor.First);
            // 2
            LightIntensitySensor = new LightSensor(Brick, NxtBrick.Sensor.Second);
            // 3 (shared)
            SoundLevelSensor = new SoundSensor(Brick, NxtBrick.Sensor.Third);
            SoundRatioSensor = new SoundDbaRatioSensor(Brick, NxtBrick.Sensor.Third);
            // 4
            UltrasonicSensor = new UltrasonicSensor(Brick, NxtBrick.Sensor.Fourth);

            // Motor sensors:
            // 1

            // Motors:
            // A,B,C
            MotorTail = new Motor(Brick, NxtBrick.Motor.A);
            MotorRight = new Motor(Brick, NxtBrick.Motor.B);
            MotorLeft = new Motor(Brick, NxtBrick.Motor.C);

            // Walk:
            WalkBehavior = new TwoMotorWalkBehavior(MotorLeft, MotorRight);
        }
 // C'tor
 public TwoMotorWalkBehavior(Motor leftMotor, Motor rightMotor)
 {
     LeftMotor = leftMotor;
     RightMotor = rightMotor;
 }