本文整理汇总了C#中Pin.ChangePwm方法的典型用法代码示例。如果您正苦于以下问题:C# Pin.ChangePwm方法的具体用法?C# Pin.ChangePwm怎么用?C# Pin.ChangePwm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pin
的用法示例。
在下文中一共展示了Pin.ChangePwm方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
//.........这里部分代码省略.........
index = stack.PopByte();
delay = stack.PopByte();
width = stack.PopByte();
value = stack.PopByte();
pin = GetPin(index, PinTypes.Output);
if (pin != null)
{
pin.PulsedOutput(delay, width, value);
done = true;
}
break;
case NodeCommands.CMD_CYCLE_DIGITAL:
index = stack.PopByte();
delay = stack.PopByte();
width = stack.PopByte();
value = stack.PopByte(); //cycles
pin = GetPin(index, PinTypes.Output);
if (pin != null)
{
pin.CycledOutput(delay, width, value);
done = true;
}
break;
#endregion
#region Pins analog/pwm write commands
case NodeCommands.CMD_CHANGE_PWM:
index = stack.PopByte();
delay = stack.PopByte(); //high pulse
width = stack.PopByte(); //total pulse
pin = GetPin(index, PinTypes.Pwm);
if (pin != null)
{
pin.ChangePwm(delay, width);
done = true;
}
break;
case NodeCommands.CMD_DELTA_PWM:
index = stack.PopByte();
value = stack.PopInt16();
pin = GetPin(index, PinTypes.Pwm);
if (pin != null)
{
pin.ChangeDelta(value);
done = true;
}
break;
case NodeCommands.CMD_FADE_PWM:
index = stack.PopByte();
//type = (PinTypes)stack.PopByte();
var startValue = stack.PopUInt16();
var endValue = stack.PopUInt16();
value = stack.PopByte(); //steps
delay = stack.PopByte();
pin = GetPin(index, PinTypes.Pwm);
if (pin != null)
{
pin.Fade(startValue, endValue, (byte)value, delay);
done = true;
}
break;
case NodeCommands.CMD_CHANGE_PIN:
name = stack.PopName();
value = stack.PopInt32();
pin = GetPin(name);
if (pin != null)