// Update is called once per frames void Update() { UduinoDevice myDevice = UduinoManager.Instance.GetBoard("myArduinoName"); UduinoManager.Instance.Read(myDevice, "mySensor"); if (Input.GetKeyUp(KeyCode.Alpha1)) { OnClick_1?.Invoke(); } if (Input.GetKeyUp(KeyCode.Alpha2)) { OnClick_2?.Invoke(); } if (Input.GetKeyUp(KeyCode.Alpha3)) { OnClick_3?.Invoke(); } if (Input.GetKeyUp(KeyCode.Alpha4)) { OnClick_4?.Invoke(); } Checker(); }
public void Checker() { if (dataInput == null) { dataInput = "1;1;1;1"; } else { var dataSplited = dataInput.Split(';'); if (dataSplited[0] == "0") { OnClick_1?.Invoke(); Debug.Log("BUTTON_01"); } if (dataSplited[1] == "0") { OnClick_2?.Invoke(); Debug.Log("BUTTON_02"); } if (dataSplited[2] == "0") { OnClick_3?.Invoke(); Debug.Log("BUTTON_03"); } if (dataSplited[3] == "0") { OnClick_4?.Invoke(); Debug.Log("BUTTON_04"); } } }
public void OnDataReceived(string data, UduinoDevice device) { Debug.Log("Received"); UduinoDebugTMP.text = data; //var dataSplited = data.Split(';'); if (dataInput == null) { dataInput = "1;1;1;1"; } else { var dataSplited = data.Split(';'); if (dataSplited[0] != dataCached[0]) { if (dataSplited[0] == "0") { OnClick_1?.Invoke(); Debug.Log("BUTTON_01"); } } if (dataSplited[1] != dataCached[1]) { if (dataSplited[1] == "0") { OnClick_2?.Invoke(); Debug.Log("BUTTON_02"); } } } }