本文整理汇总了C#中Pin.Read方法的典型用法代码示例。如果您正苦于以下问题:C# Pin.Read方法的具体用法?C# Pin.Read怎么用?C# Pin.Read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pin
的用法示例。
在下文中一共展示了Pin.Read方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
//.........这里部分代码省略.........
pin.Change(value);
done = true;
}
break;
#endregion
#region Pins read commands
case NodeCommands.CMD_GET_PIN_INFO:
index = stack.PopByte();
value = stack.PopByte();
pin = GetPin(index, (PinTypes)value);
if (pin != null)
{
_bus.Payload = PinSerializer.Serialize(pin);
done = true;
}
break;
case NodeCommands.CMD_GET_CONNECT_INFO:
index = stack.PopByte();
wire = Wires.FirstOrDefault(w => w.Index == index);
if (wire != null)
{
array = WireSerializer.Serialize(wire);
_bus.Payload = array;
done = true;
}
break;
case NodeCommands.CMD_READ_PIN:
name = stack.PopName();
pin = GetPin(name);
if (pin != null)
{
//Get pin value
var evt = new PinEvent(name, pin.Read(), pin.IsActive());
_bus.Payload = evt.ToArray();
done = true;
}
break;
case NodeCommands.CMD_READ_LAST_INPUT:
dataOut.AddRange(FixedString.ToPaddedArray(Status.LastActivatedInput, HBusSettings.NameLength, ' '));
_bus.Payload = dataOut.ToArray();
done = true;
break;
case NodeCommands.CMD_READ_LAST_ACTIVE:
dataOut.AddRange(FixedString.ToPaddedArray(Status.LastActivatedOutput, HBusSettings.NameLength, ' '));
_bus.Payload = dataOut.ToArray();
done = true;
break;
#endregion
#region Device commands
case NodeCommands.CMD_GET_DEVICE_INFO:
index = stack.PopByte();
device = GetDevice(index);
if (device != null)
{
array = DeviceSerializer.Serialize(device);
_bus.Payload = array;
done = true;
}
break;
case NodeCommands.CMD_GET_DEVICE_STATUS:
name = stack.PopName();
device = GetDevice(name);
if (device != null)
{