コード例 #1
0
            public AwesomeBlock(Cpu.Pin buttonPin, Cpu.Pin ledPin, IDCMotor leftMotor, IDCMotor rightMotor)
            {
                var button = new DigitalInputPin(buttonPin);
                var led    = new DigitalOutputPin(ledPin);



                button.Output.ConnectTo(led.Input);
                button.Output.ConnectTo(rightMotor.SpeedInput);
                button.Output.ConnectTo(leftMotor.SpeedInput);
            }
コード例 #2
0
        public TwoWheeledRobot (IDCMotor leftMotor, IDCMotor rightMotor)
        {
            this.leftMotor = leftMotor;
            this.rightMotor = rightMotor;

            DirectionInput = AddInput ("DirectionInput", Units.Scalar);
            SpeedInput = AddInput ("SpeedInput", Units.Ratio);
            SpinInput = AddInput ("SpinInput", Units.Scalar);

            Update ();

            SpeedInput.ValueChanged += (s, e) => Update ();
            DirectionInput.ValueChanged += (s, e) => Update ();
            SpinInput.ValueChanged += (s, e) => Update ();
        }
コード例 #3
0
        public TwoWheeledRobot(IDCMotor leftMotor, IDCMotor rightMotor)
        {
            this.leftMotor  = leftMotor;
            this.rightMotor = rightMotor;

            DirectionInput = AddInput("DirectionInput", Units.Scalar);
            SpeedInput     = AddInput("SpeedInput", Units.Ratio);
            SpinInput      = AddInput("SpinInput", Units.Scalar);

            Update();

            SpeedInput.ValueChanged     += (s, e) => Update();
            DirectionInput.ValueChanged += (s, e) => Update();
            SpinInput.ValueChanged      += (s, e) => Update();
        }