public int AnalogRead(Pins pin) { Response result = Post(Functions.analogread, String.Format(payloadRead, HttpUtility.UrlEncode(AccessToken), HttpUtility.UrlEncode(pin.ToString()))); return result.ReturnValue; }
public bool AnalogWrite(Pins pin, Int16 val) { if (val > 255) { val = 255; } if (val < 0) { val = 0; } Response result = Post(Functions.analogwrite, String.Format(payloadWrite, HttpUtility.UrlEncode(AccessToken), HttpUtility.UrlEncode(pin.ToString()), HttpUtility.UrlEncode(val.ToString()))); switch (result.ReturnValue) { case -1: return(false); default: return(true); } }
public override string ToString() { var s = Pins.ToString(); if (Bonus > 0) { s += $"(+{Bonus})"; } return(s); }
public GetStates DigitalWrite(Pins pin, SetStates state) { Response result = Post(Functions.digitalwrite, String.Format(payloadWrite, HttpUtility.UrlEncode(AccessToken), HttpUtility.UrlEncode(pin.ToString()), HttpUtility.UrlEncode(state.ToString()))); switch (result.ReturnValue) { case -1: return(GetStates.FAIL); default: if (state == SetStates.HIGH) { return(GetStates.HIGH); } return(GetStates.LOW); } }
public int AnalogRead(Pins pin) { Response result = Post(Functions.analogread, String.Format(payloadRead, HttpUtility.UrlEncode(AccessToken), HttpUtility.UrlEncode(pin.ToString()))); return(result.ReturnValue); }
public GetStates DigitalRead(Pins pin) { Response result = Post(Functions.digitalread, String.Format(payloadRead, HttpUtility.UrlEncode(AccessToken), HttpUtility.UrlEncode(pin.ToString()))); switch (result.ReturnValue) { case 0: return(GetStates.LOW); case 1: return(GetStates.HIGH); default: return(GetStates.FAIL); } }
public bool AnalogWrite(Pins pin, Int16 val) { if (val > 255) val = 255; if (val < 0) val = 0; Response result = Post(Functions.analogwrite, String.Format(payloadWrite, HttpUtility.UrlEncode(AccessToken), HttpUtility.UrlEncode(pin.ToString()), HttpUtility.UrlEncode(val.ToString()))); switch (result.ReturnValue) { case -1: return false; default: return true; } }
public GetStates DigitalWrite(Pins pin, SetStates state) { Response result = Post(Functions.digitalwrite, String.Format(payloadWrite, HttpUtility.UrlEncode(AccessToken), HttpUtility.UrlEncode(pin.ToString()), HttpUtility.UrlEncode(state.ToString()))); switch (result.ReturnValue) { case -1: return GetStates.FAIL; default: if (state == SetStates.HIGH) return GetStates.HIGH; return GetStates.LOW; } }
public GetStates DigitalRead(Pins pin) { Response result = Post(Functions.digitalread, String.Format(payloadRead, HttpUtility.UrlEncode(AccessToken), HttpUtility.UrlEncode(pin.ToString()))); switch (result.ReturnValue) { case 0: return GetStates.LOW; case 1: return GetStates.HIGH; default: return GetStates.FAIL; } }