示例#1
0
        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);
        }
示例#2
0
 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);
 }
示例#3
0
        public void KonashiUARTSend(UI.InputField input)
        {
            string text = input.text;

            if (!string.IsNullOrEmpty(text))
            {
                KonashiPlugin.UartWriteString(text);
                LogF("Send UART - {0}", text);
            }
        }
示例#4
0
        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)
        }
示例#5
0
 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);
     }
 }
示例#6
0
        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);
        }
示例#7
0
 void Awake()
 {
     if (_instance == null)
     {
         _instance = this;
         DontDestroyOnLoad(this);
     }
     else
     {
         if (this != _instance)
         {
             Destroy(this.gameObject);
         }
     }
 }
示例#8
0
 void OnMouseUp()
 {
     touched = false;
     KonashiPlugin.DigitalWrite(pin, KonashiLevel.Low);
 }
示例#9
0
 void OnMouseDown()
 {
     touched = true;
     KonashiPlugin.DigitalWrite(pin, KonashiLevel.High);
 }
示例#10
0
 void Awake()
 {
     if(_instance == null)
     {
         _instance = this;
         DontDestroyOnLoad(this);
     }
     else
     {
         if(this != _instance)
             Destroy(this.gameObject);
     }
 }
示例#11
0
 public void KonashiSignalStrengthReadRequest()
 {
     KonashiPlugin.SignalStrengthReadRequest();
 }
示例#12
0
 public void KonashiBatteryLevelReadRequest()
 {
     KonashiPlugin.BatteryLevelReadRequest();
 }
示例#13
0
 public void KonashiDisconnect()
 {
     KonashiPlugin.Disconect();
 }
示例#14
0
 public void KonashiFind()
 {
     Log("Now serching...Wait for seconds.");
     KonashiPlugin.Find();
     // UnityKonashiPlugin.Find("konashi_1234"); // Also able to find with name
 }
示例#15
0
        public void KonashiLEDSlider4Changed(UI.Slider slider)
        {
            int level = (int)(slider.normalizedValue * 100);

            KonashiPlugin.PwmLedDrive(KonashiDigitalIOPin.DigitalIO4, level);
        }