Shop OBEX P1 Docs P2 Docs Learn Events
C# on PC: how to toggle DTR to Prop/FT231X? — Parallax Forums

C# on PC: how to toggle DTR to Prop/FT231X?

Tracy AllenTracy Allen Posts: 6,664
edited 2015-05-29 08:44 in General Discussion
The programmer I'm working with does not know how to control DTR using C# on the PC. It would be really convenient on my side with the propeller if the PC could do that in order to reset the prop to a known state. Does anyone have any quick tips or links I could pass on about how to work it? I'm clueless about C#.

Comments

  • tonyp12tonyp12 Posts: 1,951
    edited 2015-05-29 08:44
    As you have to go through the virtual comport, I guess this way below is the way to do it:
    I have not tried it as I used a UART HID devices that can toggle any pin manually.
    using (SerialPort serialPort = new SerialPort("COM1", 9600))
    {
        serialPort.Open();
        while (true)
        {
            Thread.Sleep(1000);
            serialPort.DtrEnable = true;
            Thread.Sleep(1000);
            serialPort.DtrEnable = false;
        }
        serialPort.Close();
    }
    
Sign In or Register to comment.