我有一个帖子,我想用串口发送一些命令。我该怎么做?
Thread execProcess = new Thread(eProcess);
static bool isRunning = false;
static void eProcess()
{
while(true)
{
if(isRunning)
{
sendCmd(cmd); //cmd is a string
}
}
}
void sendCmd(string cmd)
{
serialPort.WriteLine(cmd);
}
我该怎么做?