English 中文(简体)
前往Arduino Uno的飞机
原标题:pySerial writes to Arduino Uno get buffered

我有一篇用短信写短信给我的Arduino Uno委员会上的序列港口,使用高空。 存在一种假体,视某些条件而定,多份书写可在休息室内进行,例如:

while True:
    #Conditions block 1
    if <CONDITION1>:
        serial.writelines("INIT")
    elif <CONDITION2>:
        serial.writelines("NEW")
    ...

    #Conditions block 2
    if <CONDITION1>:
        # Fetch something from the Internet
        serial.writelines("CHECK")
    elif <CONDITION2>:
        # Fetch something from the Internet
        serial.writelines("STOP")
    ...

但是,当我的Arduino委员会收到这一信息时,它会收到第一份作为INIT的信息,但第二份信息正在被解读为INITSTOP或INITCHECK,第三个信息被压缩到以前的信息中。 我的ard子方案以这种方式检查具体信息:

if(msg.equals("CHECK")) {
    // Do something
}
else if(msg.equals("INIT")) {
    // Do Something else
}

谁能指导我这样做? BTW,我并不认为问题在于Arduino,因为当我与国际民主和选举援助学会的Serial Monitor一道测试这一问题时,它完全发挥作用。

我试图在每封信之前增加最多10秒的睡觉,但这不是去做。

问题回答

而是:

serial.write("INIT
")

www.un.org/Depts/DGACM/index_french.htm 也许需要一份清单(但我现在可以核对)。





相关问题
How to "echo off" the serial port in java

I am using java comm library for serial port communication in my application. When I put some data on output stream, after sometime the same command is displayed on input stream of serial port. Do ...

Can someone please explain COMTIMEOUTS for me?

I have an application that has strict timing. Inter-character delay must be no more than is 0.15s The messages themselves are quite small. 10 - 50 chars I don t understand what ...

Unable to open serial port in .NET

I am trying to open COM1, but get a strange error every time I call SerialPort.Open(). The error is: The given port name does not start with COM/com or does not resolve to a valid serial port. ...

Serial programming: measuring time between characters

I am sending/receiving data over a serial line in Linux and I would like to find the delay between characters. Modbus uses a 3.5 character delay to detect message frame boundaries. If there is more ...

send string to serial

Buongiorno, I m trying to send a simple string to a serial port to command an instrument for noise measures. The strings are very easy: "M 1" = instrument on "M 2" = instrument off "M 3" = begin the ...

Java RS232 Comm on Vista-64 bit

We have a Java application which needs to communicate with a peripheral device over Virtual Serial COM port. We use the RS232 Java COMM API (javax.comm.properties, comm.jar, win32com.dll) to achieve ...

热门标签