ofSerial writeByte issue

i’m not too sure is this a bug or what,i’m testing a really simple app which send command to trigger the arduino delay module

something like this:

serial.enumerateDevices();
vector deviceList = serial.getDeviceList();
int baud = 9600;
serial.setup(“COM3”, baud); // windows example

if (key == OF_KEY_F3)
{

		serial.writeByte('1');
		ofSleepMillis(100);
		
	
	
}

if i’m keep sending to the arduino,after the 5-6 times, the ofSerial somtimes reports couldn’t write to the port,got
no response at all. or it just not trigger immediately have to wait like 5-8s to get responsed.

but same code in processing,seems working really fine,each time when i pressed the command key the arduino will be trigger immediately.

under the windows 10, OF version github 090 ,does anyone got same issue?
cheers

Assuming that in both cases you are sending an ASCII ‘1’, not the byte of decimal value 1 … ?

Hm … does ofxSerial give you similar issues (https://github.com/bakercp/ofxSerial use develop branches for 0.9.0)?

is this correct?

ofx::IO::SerialDevice device;
std::vectorofx::IO::SerialDeviceInfo devicesInfo = ofx::IO::SerialDeviceUtils::listDevices();
ofLogNotice(“ofApp::setup”) << "Connected Devices: ";

for (std::size_t i = 0; i < devicesInfo.size(); ++i)
{
	ofLogNotice("ofApp::setup") << "\t" << devicesInfo[i];
}

if (!devicesInfo.empty())
{
	// Connect to the first matching device.
	bool success = device.setup(devicesInfo[0], 9600);

}

void ofApp::keyPressed(int key){

if (key == OF_KEY_F3)
{
	
	device.writeByte('1');
	
}

}

after sending 7-8 times,it will break at the this line of code in win.cc
THROW (IOException, ss.str().c_str());