Thanks poslathian. For testing I use a little processing sketch.
This works fine with 0.0.9 but not with 0.0.11.
myPort.write(char(1)+""+char(val%255)); // key + value
When I send the bytes seperatly it works most of the time. But sometimes I have the same bytes in "key" and "value". I can avoid that by adding a little delay between the bytes:
myPort.write(1); // key
delay(1);
myPort.write(val%255); //value
the whole sketch looks like:
import processing.serial.*;
int lf = 10;
String myString = null;
Serial myPort;
int val = 0;
void setup()
{
size(200, 200);
String portName = Serial.list()[0];
myPort = new Serial(this, portName, 115200);
}
void draw() {
while (myPort.available() > 0) {
myString = myPort.readStringUntil(lf);
if (myString != null) {
println("receive: "+trim(myString));
}
}
myPort.write(char(1)+""+char(val%255)); // key + value
val++;
delay(250);
}
EDIT:
I tested some more staightforward code:
on maple:
boolean linebreak = false;
void setup() {
// nothing
}
void loop() {
while (SerialUSB.available()) {
SerialUSB.print(SerialUSB.read());
linebreak = true;
}
if (linebreak) {
SerialUSB.println();
linebreak = false;
}
delay(100);
}
in processing:
import processing.serial.*;
int lf = 10;
String myString = null;
Serial myPort;
int val = 0;
void setup()
{
size(200, 200);
String portName = Serial.list()[0];
myPort = new Serial(this, portName, 115200);
}
void draw() {
while (myPort.available() > 0) {
myString = myPort.readStringUntil(lf);
if (myString != null) {
println("receive: "+trim(myString));
}
}
myPort.write("abc");
delay(250);
}
the output in 0.0.9 is:
receive: abc
in 0.0.11:
receive: aaa
thanks,
ralf