本文整理汇总了C#中OutputPort类的典型用法代码示例。如果您正苦于以下问题:C# OutputPort类的具体用法?C# OutputPort怎么用?C# OutputPort使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OutputPort类属于命名空间,在下文中一共展示了OutputPort类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TurnMotorAtSpeedAsync
TurnMotorAtSpeedAsync(OutputPort ports, int speed)
{
return TurnMotorAtSpeedAsyncInternal(ports, speed)
#if WINRT
.AsAsyncAction()
#endif
;
}
示例2: StepMotorAtPowerAsync
StepMotorAtPowerAsync(OutputPort ports, int power, uint steps, bool brake)
{
return StepMotorAtPowerAsyncInternal(ports, power, 0, steps, 0, brake)
#if WINRT
.AsAsyncAction()
#endif
;
}
示例3: TurnMotorAtPowerAsync
TurnMotorAtPowerAsync(OutputPort ports, int power)
{
return TurnMotorAtPowerAsyncInternal(ports, power)
#if WINRT
.AsAsyncAction()
#endif
;
}
示例4: SharpGP2D12
// From http://www.sharpsma.com/webfm_send/1203
public SharpGP2D12 ()
{
AnalogInput = new InputPort (this, "AnalogInput", Units.Ratio);
DistanceOutput = new OutputPort (this, "DistanceOutput", Units.Distance, 0);
lookup = new LookupTable {
{ 0.0912, 0.7904 },
{ 0.1086, 0.6472 },
{ 0.1476, 0.4352 },
{ 0.2094, 0.2912 },
{ 0.2976, 0.196 },
{ 0.3876, 0.1456 },
{ 0.528, 0.0976 },
};
lookup.Input.ConnectTo (AnalogInput);
lookup.Output.ConnectTo (DistanceOutput);
}
示例5: TurnMotorAtPowerForTime
/// <summary>
/// Turn the motor connected to the specified port or ports at the specified power for the specified times.
/// </summary>
/// <param name="ports">A specific port or Ports.All.</param>
/// <param name="power">The power at which to turn the motor (-100% to 100%).</param>
/// <param name="milliseconds">Number of milliseconds to run at constant power.</param>
/// <param name="brake">Apply brake to motor at end of routine.</param>
/// <returns></returns>
public void TurnMotorAtPowerForTime(OutputPort ports, int power, uint milliseconds, bool brake)
{
TurnMotorAtPowerForTime(ports, power, 0, milliseconds, 0, brake);
}
示例6: StepMotorAtSpeed
/// <summary>
/// Step the motor connected to the specified port or ports at the specified speed for the specified number of steps.
/// </summary>
/// <param name="ports">A specific port or Ports.All.</param>
/// <param name="speed">The speed at which to turn the motor (-100% to 100%).</param>
/// <param name="steps"></param>
/// <param name="brake">Apply brake to motor at end of routine.</param>
public void StepMotorAtSpeed(OutputPort ports, int speed, uint steps, bool brake)
{
StepMotorAtSpeed(ports, speed, 0, steps, 0, brake);
}
示例7: StepMotorAtPower
/// <summary>
/// Step the motor connected to the specified port or ports at the specified power for the specified number of steps.
/// </summary>
/// <param name="ports">A specific port or Ports.All.</param>
/// <param name="power">The power at which to turn the motor (-100% to 100%).</param>
/// <param name="steps">The number of steps to turn the motor.</param>
/// <param name="brake">Apply brake to motor at end of routine.</param>
public void StepMotorAtPower(OutputPort ports, int power, uint steps, bool brake)
{
StepMotorAtPower(ports, power, 0, steps, 10, brake);
}
示例8: SetMotorPolarityAsyncInternal
internal async Task SetMotorPolarityAsyncInternal(OutputPort ports, Polarity polarity)
{
Command c = new Command(CommandType.DirectNoReply);
c.SetMotorPolarity(ports, polarity);
await _brick.SendCommandAsyncInternal(c);
}
示例9: TurnMotorAtSpeed
/// <summary>
/// Turn the specified motor at the specified speed.
/// </summary>
/// <param name="ports">Port or ports to apply the command to.</param>
/// <param name="speed">The speed to apply to the specified motors (-100% to 100%).</param>
public void TurnMotorAtSpeed(OutputPort ports, int speed)
{
if(speed < -100 || speed > 100)
throw new ArgumentException("Speed must be between -100 and 100 inclusive.", "speed");
AddOpcode(Opcode.OutputSpeed);
AddParameter(0x00); // layer
AddParameter((byte)ports); // ports
AddParameter((byte)speed); // speed
}
示例10: TurnMotorAtSpeedForTime
/// <summary>
/// Turn the motor connected to the specified port or ports at the specified speed for the specified times.
/// </summary>
/// <param name="ports">A specific port or Ports.All.</param>
/// <param name="speed">The power at which to turn the motor (-100% to 100%).</param>
/// <param name="milliseconds">Number of milliseconds to run at constant speed.</param>
/// <param name="brake">Apply brake to motor at end of routine.</param>
/// <returns></returns>
public void TurnMotorAtSpeedForTime(OutputPort ports, int speed, uint milliseconds, bool brake)
{
TurnMotorAtSpeedForTime(ports, speed, 0, milliseconds, 0, brake);
}
示例11: SetMotorPolarity
/// <summary>
/// Append the Set Polarity command to an existing Command object
/// </summary>
/// <param name="ports">Port or ports to change polarity</param>
/// <param name="polarity">The new polarity (direction) value</param>
public void SetMotorPolarity(OutputPort ports, Polarity polarity)
{
AddOpcode(Opcode.OutputPolarity);
AddParameter(0x00);
AddParameter((byte)ports);
AddParameter((byte)polarity);
}
示例12: StopMotor
/// <summary>
/// Append the Stop Motor command to an existing Command object
/// </summary>
/// <param name="ports">Port or ports to stop</param>
/// <param name="brake">Apply the brake at the end of the command</param>
public void StopMotor(OutputPort ports, bool brake)
{
AddOpcode(Opcode.OutputStop);
AddParameter(0x00); // layer
AddParameter((byte)ports); // ports
AddParameter((byte)(brake ? 0x01 : 0x00)); // brake (0 = coast, 1 = brake)
}
示例13: StartMotorAsyncInternal
internal async Task StartMotorAsyncInternal(OutputPort ports)
{
Command c = new Command(CommandType.DirectNoReply);
c.StartMotor(ports);
await _brick.SendCommandAsyncInternal(c);
}
示例14: AddOutput
internal void AddOutput()
{
var output = new OutputPort("Output" + Brain.KB.Sources.GetOutputPorts().Count);
Brain.KB.Sources.AddOutputPort(output);
LoadOutputs();
ui.listBoxOutputs.SelectedIndex = OutputPorts.Count - 1;
LoadSignals();
}
示例15: Generator
public Generator (double updateFrequency = DefaultUpdateFrequency)
: base (updateFrequency)
{
startTicks = DateTime.UtcNow.Ticks;
Output = AddOutput ("Output", Units.Scalar, 0);
}