IEnumerator _RunLED() { float duration = 0.5f; LogF("1:ON"); KonashiPlugin.DigitalWrite(KonashiDigitalIOPin.DigitalIO1, KonashiLevel.High); yield return(new WaitForSeconds(duration)); KonashiPlugin.DigitalWrite(KonashiDigitalIOPin.DigitalIO1, KonashiLevel.Low); LogF("2:ON"); KonashiPlugin.DigitalWrite(KonashiDigitalIOPin.DigitalIO2, KonashiLevel.High); yield return(new WaitForSeconds(duration)); KonashiPlugin.DigitalWrite(KonashiDigitalIOPin.DigitalIO2, KonashiLevel.Low); LogF("3:ON"); KonashiPlugin.DigitalWrite(KonashiDigitalIOPin.DigitalIO3, KonashiLevel.High); yield return(new WaitForSeconds(duration)); KonashiPlugin.DigitalWrite(KonashiDigitalIOPin.DigitalIO3, KonashiLevel.Low); LogF("4:ON"); KonashiPlugin.DigitalWrite(KonashiDigitalIOPin.DigitalIO4, KonashiLevel.High); yield return(new WaitForSeconds(duration)); KonashiPlugin.DigitalWrite(KonashiDigitalIOPin.DigitalIO4, KonashiLevel.Low); }
public void KonashiSetupPWMMode() { LogF("Set 1~4:PWM LED"); KonashiPlugin.PwmMode(KonashiDigitalIOPin.DigitalIO1, KonashiPWMMode.EnableLED); KonashiPlugin.PwmMode(KonashiDigitalIOPin.DigitalIO2, KonashiPWMMode.EnableLED); KonashiPlugin.PwmMode(KonashiDigitalIOPin.DigitalIO3, KonashiPWMMode.EnableLED); KonashiPlugin.PwmMode(KonashiDigitalIOPin.DigitalIO4, KonashiPWMMode.EnableLED); }
public void KonashiUARTSend(UI.InputField input) { string text = input.text; if (!string.IsNullOrEmpty(text)) { KonashiPlugin.UartWriteString(text); LogF("Send UART - {0}", text); } }
public void KonashiSetupPinmode() { LogF("Set pin 0:In, 1~4:Out"); LogF("Now push the switch - this is DisitalIO0."); KonashiPlugin.PinMode(KonashiDigitalIOPin.DigitalIO0, KonashiPinMode.Input); KonashiPlugin.PinMode(KonashiDigitalIOPin.DigitalIO1, KonashiPinMode.Output); KonashiPlugin.PinMode(KonashiDigitalIOPin.DigitalIO2, KonashiPinMode.Output); KonashiPlugin.PinMode(KonashiDigitalIOPin.DigitalIO3, KonashiPinMode.Output); KonashiPlugin.PinMode(KonashiDigitalIOPin.DigitalIO4, KonashiPinMode.Output); // All set // UnityKonashiPlugin.PinModeAll(KonashiPinMode.Input) }
public void KonashiUARTSetup(UI.Toggle toggle) { if (toggle.isOn) { Log("Turn On UART"); KonashiPlugin.UartMode(KonashiUartMode.Enable, KonashiUartBaudrate.Rate9K6); } else { Log("Turn Off UART"); KonashiPlugin.UartMode(KonashiUartMode.Disable, KonashiUartBaudrate.Rate9K6); } }
void Start() { var konashi = KonashiPlugin.instance; konashi.Initialize(); konashi.OnReady += () => { KonashiPlugin.PinMode(KonashiDigitalIOPin.DigitalIO1, KonashiPinMode.Output); KonashiPlugin.PinMode(KonashiDigitalIOPin.DigitalIO2, KonashiPinMode.Output); KonashiPlugin.PinMode(KonashiDigitalIOPin.DigitalIO3, KonashiPinMode.Output); }; KonashiPlugin.Find(konashiName); }
void Awake() { if (_instance == null) { _instance = this; DontDestroyOnLoad(this); } else { if (this != _instance) { Destroy(this.gameObject); } } }
void OnMouseUp() { touched = false; KonashiPlugin.DigitalWrite(pin, KonashiLevel.Low); }
void OnMouseDown() { touched = true; KonashiPlugin.DigitalWrite(pin, KonashiLevel.High); }
void Awake() { if(_instance == null) { _instance = this; DontDestroyOnLoad(this); } else { if(this != _instance) Destroy(this.gameObject); } }
public void KonashiSignalStrengthReadRequest() { KonashiPlugin.SignalStrengthReadRequest(); }
public void KonashiBatteryLevelReadRequest() { KonashiPlugin.BatteryLevelReadRequest(); }
public void KonashiDisconnect() { KonashiPlugin.Disconect(); }
public void KonashiFind() { Log("Now serching...Wait for seconds."); KonashiPlugin.Find(); // UnityKonashiPlugin.Find("konashi_1234"); // Also able to find with name }
public void KonashiLEDSlider4Changed(UI.Slider slider) { int level = (int)(slider.normalizedValue * 100); KonashiPlugin.PwmLedDrive(KonashiDigitalIOPin.DigitalIO4, level); }