Unity C# and Phidget22 Action
Posted: Thu Aug 06, 2020 6:31 pm
Hello everyone!
Im trying to work with a DigitalInput. My issue is the OnStateChange event only fires 2 times. Has anyone else experienced this issue?
True will log 1 time and so will False. Any ideas what I'm doing wrong?
Im trying to work with a DigitalInput. My issue is the OnStateChange event only fires 2 times. Has anyone else experienced this issue?
Code: Select all
private void StateChange(object sender, DigitalInputStateChangeEventArgs e)
{
Debug.Log(e.State);
OnStateChange?.Invoke(e.State);
}
Code: Select all
public bool Open()
{
bool success = false;
try {
_Phidget.StateChange += StateChange;
_Phidget.Open();
HubPort = _Phidget.HubPort;
HubLabel = _Phidget.DeviceLabel;
success = true;
} catch { Debug.Log("Unable to open Digital Input"); }
return success;
}