IEnumerator test()
    {
        for (int i = 0; i < 50; i++)
        {
            for (float interval = 0.4f; interval <= 2.0f; interval += 0.4f)
            {
                var start = DateTime.Now;
                PortControl.Output(decAdd, 255);
                yield return(new WaitForSeconds(0.2f));

                var end = DateTime.Now;
                PortControl.Output(decAdd, 0);
                yield return(new WaitForSeconds(interval - 0.2f));
                //PortcontrolTestWriter.I.Write(start, end);
            }
        }

        for (int i = 0; i < 50; i++)
        {
            for (float interval = 0.4f; interval <= 2.0f; interval += 0.4f)
            {
                var start = DateTime.Now;
                PortControl.Output(decAdd, 255);
                yield return(new WaitForSeconds(interval));

                var end = DateTime.Now;
                PortControl.Output(decAdd, 0);
                yield return(new WaitForSeconds(interval));
                //PortcontrolTestWriter.I.Write(start, end);
            }
        }

        label.SetActive(true);
    }
    public IEnumerator Out(int data)
    {
        yield return(new WaitForEndOfFrame());

        PortControl.Output(decAdd, data);
        Invoke("Close", 0.2f);
    }
 void Update()
 {
     if (open)
     {
         decData = 255;
         PortControl.Output(decAdd, decData);
     }
     else
     {
         decData = 0;
         PortControl.Output(decAdd, decData);
     }
 }
 void Close()
 {
     PortControl.Output(decAdd, 0);
 }