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); }
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 (); }
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(); }